形成认证问题 [英] form authitication problem
问题描述
我在我的网络应用程序中使用表格自动化,并且习惯于可以为登录页面定制设计。
经过授权用户我设置此行:
FormsAuthentication.RedirectFromLoginPage(txtLoginName.Value,blnFlag);
但此行之后执行页面无法重定向默认页面。
我的web.config文件设置中的
是:
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:
<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
推荐答案
为什么不做一个Response.Redirect?
Why not just do a Response.Redirect ?
FormsAuthentication.RedirectFromLoginPage
用于发送用户到他们试图直接访问的任何URL。例如,如果我是您网站的用户,并且我尝试浏览http://yoursite/somepage.aspx,如果我尚未通过身份验证,那么.Net会将我发送到您的登录页面。如果您调用
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
FormsAuthentication.RedirectFromLoginPage
,则在验证我的登录信息后,我将被发送到somepage.aspx。如果你总是希望他们转到default.aspx,那么Response.Redirect代替他们。
I will be sent to somepage.aspx. If you always want them to go to default.aspx then Response.Redirect them instead.
添加
defaultUrl="Default.aspx"
在Web.config文件的表单标记中。
in your forms tag of Web.config file.
这篇关于形成认证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!