Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am using Login control in ASPnet membership
I added a link in this control (ex: forget password), want user to redirect to next page(eg:Forgetpassword.aspx)
VB
<asp:Login ID="Login1" runat="server"  EnableViewState="true"
         OnLoggedIn="Login1_LoggedIn"   >

XML
<asp:LinkButton ID ="ForgotPassword" runat="server"
                                            onclick="ForgotPassword_Click" >Forgot password</asp:LinkButton>






on using Membership I have a returnurl problem in login page
so i used in global.asax
//my code goes here
C#
void Application_BeginRequest(object sender, EventArgs e)
   {
       string path = HttpContext.Current.Request.Url.PathAndQuery;
       string pagequery = path.Substring(path.LastIndexOf("/") + 1);
       string[] pagequery_Elements = pagequery.Split('?');
       string ReturnUrl = pagequery_Elements[pagequery_Elements.Length - 1];

       if (ReturnUrl.Contains("ReturnUrl"))
       {         
           Response.Redirect("~/login.aspx", true);
       }
   }

before my url was //...login.aspx?ReturnUrl=%2fReport%2fDefault.aspx
on doing this Returnurl in login page problem was overcomed..
i dont want to use aspnet membership recover password
my web.config
XML
<authentication mode="Forms">
      <forms name=".ASPXFORMSAUTH" loginUrl="login.aspx" protection="All" path="/" timeout="43200"    requireSSL="false"
      slidingExpiration="true"
      cookieless="UseCookies"
      enableCrossAppRedirects="false" />
    </authentication>



//MY PROBLEM
I want to redirect user to next page on clicking a linkbutton... from login page
my buttonclick event doesnt redirects to next page..and redirects to login page itself.. from global.asax ..
How to overcome this..?
Please help me..
thanks in advance..
Posted

1 solution

You may have to allow access to forgot password page to all users. Try adding the following code to the web.config file.

XML
<configuration>
   <location path="Forgetpassword.aspx">
      <system.web>
         <authorization>
            <allow users="*"/>
         </authorization>
      </system.web>
   </location>
</configuration>
 
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