Mishigen
Mishigen

Reputation: 1261

how to redirect to default page on logout

i have a masterpage which contains loginstatus control

<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

Upvotes: 2

Views: 10615

Answers (3)

badr slaoui
badr slaoui

Reputation: 1063

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.

Upvotes: 1

Matt
Matt

Reputation: 3812

Try placing this in your web.config file.

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

Upvotes: 2

Cammy
Cammy

Reputation: 119

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.

Upvotes: 6

Related Questions