ASP.net会员,返回网址和重定向页面 [英] ASP.net Membership,Return url and Redirect page

查看:96
本文介绍了ASP.net会员,返回网址和重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASPnet会员中使用Login控件

我在此控件中添加了一个链接(例如:忘记密码),希望用户重定向到下一页(例如:Forgetpassword.aspx)

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)

<asp:Login ID="Login1" runat="server"  EnableViewState="true"
         OnLoggedIn="Login1_LoggedIn"   >




<asp:LinkButton ID ="ForgotPassword" runat="server"

                                            onclick="ForgotPassword_Click" >Forgot password</asp:LinkButton>













使用会员资格我在登录页面有一个返回问题

所以我在global.asax中使用

//我的代码在这里







on using Membership I have a returnurl problem in login page
so i used in global.asax
//my code goes here

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);
       }
   }



我的网址是//...login.aspx?ReturnUrl=%2fReport%2fDefault.aspx

这样做在登录页面上的Returnurl问题被克服了..

i不想使用aspnet会员恢复密码

我的web.config


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

<authentication mode="Forms">
      <forms name=".ASPXFORMSAUTH" loginUrl="login.aspx" protection="All" path="/" timeout="43200"    requireSSL="false"

      slidingExpiration="true"

      cookieless="UseCookies"

      enableCrossAppRedirects="false" />
    </authentication>







/ /我的问题

我想通过点击链接按钮将用户重定向到下一页...来自登录页面

我的buttonclick事件没有重定向到下一页..并重定向到登录页面本身..来自global.asax ..

如何克服这个...?

请帮助我...

提前感谢..

推荐答案

您可能必须允许所有用户访问忘记密码页面。尝试将以下代码添加到web.config文件中。



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

<configuration>
   <location path="Forgetpassword.aspx">
      <system.web>
         <authorization>
            <allow users="*"/>
         </authorization>
      </system.web>
   </location>
</configuration>


这篇关于ASP.net会员,返回网址和重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆