Click here to Skip to main content
15,911,762 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using form authotication in my web application and used to may custom design for login page.

after authorised user i set this line:

FormsAuthentication.RedirectFromLoginPage(txtLoginName.Value, blnFlag);

but after this line execute page can not redirect default page.


in my web.config file setting is:

XML
<authentication mode="Forms">
      <forms name=".TransportAuth" loginUrl="/Login/Login.aspx"></forms>
    </authentication>
    <authorization>
      <deny users="?"/>
    </authorization>




what i do to redirect page to default page.

Thanks in advance
Posted

Why not just do a Response.Redirect ?
 
Share this answer
 
C#
FormsAuthentication.RedirectFromLoginPage
is used to send the user to whatever URL they were trying to get to directly. For example, if I am a user of your site and I try to browse to http://yoursite/somepage.aspx if I have not been authenticated then .Net will send me to your login page. After you authenticate my login if you call
C#
FormsAuthentication.RedirectFromLoginPage
I will be sent to somepage.aspx. If you always want them to go to default.aspx then Response.Redirect them instead.
 
Share this answer
 
Add
HTML
defaultUrl="Default.aspx"
in your forms tag of Web.config file.
 
Share this answer
 
<pre lang="xml"><authentication mode="Forms">
      <forms name=".TransportAuth" loginUrl="/Login/Login.aspx"defaultUrl="Default.aspx"></forms>
    </authentication>
    <authorization>
      <deny users="?"/>
    </authorization>


 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



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