[英]ASP.Net Web Forms LoginStatus Multiple LoginURL - suggestions?
I am developing a multi-lingual website. 我正在开发一个多语言的网站。 I am determining the requested language via a querystring variable eg: http://mydomain.com/default.aspx?lang=en
我正在通过查询字符串变量确定请求的语言,例如: http ://mydomain.com/default.aspx?lang= en
I am using two <asp:LoginStatus />
controls in my masterpage. 我在
<asp:LoginStatus />
使用了两个<asp:LoginStatus />
控件。 My web.config file is set up like this for forms authentication. 我的web.config文件是这样设置的,用于表单身份验证。
<authentication mode="Forms">
<forms loginUrl="~/login.aspx" protection="All" timeout="30"
name=".ASPXAUTH" path="/" requireSSL="false"
slidingExpiration="true"
defaultUrl="default.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false"/>
</authentication>
Currently when you click on a <asp:LoginStatus />
you will be redirected to my login page and the url will look something like this: http://mydomain.com/login.aspx?ReturnUrl=%2fdefault.aspx%3flang%3den 当前,当您单击
<asp:LoginStatus />
您将被重定向到我的登录页面,并且该URL将类似于以下内容: http <asp:LoginStatus />
3den
What solutions are available to me so that I can append my lang variable to my login.aspx? 我可以使用哪些解决方案,以便将lang变量附加到我的login.aspx? depending on which language is currently active?
取决于当前使用哪种语言?
Your login.aspx code-behind can HttpServerUtility.UrlDecode the ReturnUrl variable. 您的login.aspx代码背后可以HttpServerUtility.UrlDecode ReturnUrl变量。 Then use HttpUtility.ParseQueryString() to get the lang param.
然后使用HttpUtility.ParseQueryString()获取lang参数。
Eg. 例如。
HttpUtility.ParseQueryString(HttpUtility.UrlDecode(Request.Params["ReturnUrl"]));
Of course in real life you'd check if that request variable even exists 当然,在现实生活中,您会检查该请求变量是否存在
HttpUtility.ParseQueryString() HttpUtility.ParseQueryString()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.