Click here to Skip to main content
15,896,606 members

ReturnUrl issue with form authentication

Sagar Khairnar 55 asked:

Open original thread
Hello everyone,
I m working on Asp.net 4.0 c#

I am facing issue with redirecting on home page.
What exactly happening
I am creating a new site with the functionality
- form authentication
- custom role provider
- site map (from web.sitemap)
The site is build and debug properly.
And my requirement is when any one visit to site he should able to see the home.aspx (home page of Site)but
when i am running the site it's redirecting to login.aspx(login page of site) and my URL becomes as
"http://localhost:1552/aspx/Login.aspx?ReturnUrl=%2faspx%2fHome.aspx"

Also the master page is not applying with its CSS, only the content of master page is displaying.

Web.config file changes for form authentication are
XML
<authentication mode="Forms">
    <forms defaultUrl="~/aspx/Home.aspx"  loginUrl="~/aspx/Login.aspx"  timeout="60"/>
  </authentication>


# For sitemap, Web.config changes are
XML
<siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">
      <providers>
        <clear />
        <add name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
     siteMapFile="web.sitemap" securityTrimmingEnabled="true"  />
      </providers>
    </siteMap>

    <authorization>
      <deny users="?" />
    </authorization>


And for authentication i have 2 type of user 1. from admin and another one guest
for there aspx page i have separately create the folder structure and in web.config i provide there location as
XML
<location path="aspx/_admin">
   <system.web>
     <authorization>
       <allow roles ="admin"/>
       <deny users="*"/>
     </authorization>
   </system.web>
 </location>
 <location path ="aspx/_guest" >
   <system.web>
     <authorization>
       <allow roles="guest" />
       <deny users="*"/>
     </authorization>
   </system.web>
 </location>


I think the issue is related to form authentication or may be due to the location tag which i have specified in web.config file
Its a urgent requirement, the dead-line is too short. please help me if any one knows the solution
Tags: C# (C# 4.0), ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900