开发者

how to redirect to default page on logout

i have a masterpage which contains loginstatus contr开发者_JAVA百科ol

<asp:LoginStatus ID="LoginStatus1" runat="server" 
                     LogoutAction="Redirect" LogoutPageUrl="Default.aspx" />

now on logout click i want to redirect the page to default.aspx but it is not working


I've been playing around with the login controls recently too and the only difference between what I have and yours is the "~/" in the logoutpageurl property. So try this;

<asp:LoginStatus ID="LoginStatus1" runat="server" 
     LogoutAction="Redirect"
     LogoutPageUrl="~/Default.aspx" />

Hope this helps.


Try placing this in your web.config file.

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


you can just use the logoutAction attribute and set it to redirectToLoginPage

<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="RedirectToLoginPage" />

that's suppose that in your web.config you add :

<forms loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx" />

the logout action will redirect you then to the loginUrl.

if you want to redirect to specific url you set logoutAction to redirect and you specify whatever url you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜