Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms authentication not working

Status
Not open for further replies.

G12Consult

Programmer
May 12, 2016
77
AU
I have the following in my web.config file

Code:
<system.web>
<authentication mode="Forms">
        <forms name=".loginform" loginUrl="login.aspx" protection="All" timeout="30" slidingExpiration="true" path="/" />
      </authentication>

      <authorization>
        <deny users="?" />
        <!-- Deny all unauthenticated users -->
      </authorization>
      
    </system.web>

Code:
 <location path="app/admin" >
    <system.web>
      <authorization>
        <deny users="?" />
               
      </authorization>
    </system.web>
  </location>

When the user successfully authenticates, it takes them to the page app/admin/dashboard.aspx, however kicks me back to the login page. Shouldn't the location code above allow authenticated users to access the page?
 
I'm not sure why this is happening. I would remove the whole location path element and then add defaultUrl= "app/admin/dashboard.aspx". Something like this:
Code:
<forms name=".loginform" loginUrl="login.aspx" protection="All" timeout="30" slidingExpiration="true" path="/"
       [bold][red]defaultUrl= "app/admin/dashboard.aspx"[/red][/bold] />
 
I modified my code to
Code:
FormsAuthentication.SetAuthCookie(Request.Form("EmailAddress"), True)
Response.Redirect("app/investor/dashboard.aspx")

And it seem to work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top