LoginView control not working when logging out from Sitecore extranet domain

by aboo bolaky 29. July 2009 06:19

Let's not re-invent the wheel and make use of the ASP.NET 2.0 LoginView control to generate Login/Logout actions for the Sitecore extranet domain.

We have our LoginView control (very simplistic example given here) in a sublayout.

<asp:LoginView ID="loginView" runat="server">
	<AnonymousTemplate>
	  Welcome Guest <asp:LoginStatus runat="server" LoginText="Login" />
	</AnonymousTemplate>
        
	<LoggedInTemplate>
	  Welcome <%= Sitecore.Context.User.Name %>.
	  <asp:LoginStatus runat="server" LogoutText="Logout"
	   LogoutPageUrl="/" LoginText="Login" LogoutAction="Redirect" />
	</LoggedInTemplate>
</asp:LoginView>

LoginView Control Caveat

The LoginView control "magically" knows the login page url. This is specified by the LoginUrl attribute in the FormsAuthentication section of the web.config. This is not to be confused the LoginPage attribute (from the sites section). I had to modify my web.config to

 <authentication mode="Forms">
   <forms name=".ASPXAUTH" cookieless="UseCookies" 
		loginUrl="~/General/Login.aspx" />
 </authentication>

Erractic Behaviour when logging out

I did not experience any problems when logging in .i.e. the control did what is was supposed to do (display sitecore username and Logout Link). HOWEVER, when I pressed the Logout link, I always got redirected the Sitecore Layout page instead. I did spot similar behaviour with ListViews in Sitecore (also documented by Paul George and Mark Cassidy, where its events were not being fired at all. I've made the following change to my web.config and that solved the problem :)

<typesThatShouldNotBeExpanded>
   <type>System.Web.UI.WebControls.Repeater>/type>
   <type>System.Web.UI.WebControls.DataList>/type>
   <type>System.Web.UI.WebControls.LoginView>/type>
</typesThatShouldNotBeExpanded>

 

A similar problem that relates to the  typesThatShouldNotBeExpanded tag has also been documented on SDN

Tags: ,

.Net | Applications | Sitecore

Comments

5/19/2010 12:27:13 PM #

latin shoes

thanks for your article

latin shoes United States |

5/19/2010 12:28:37 PM #

latin shoes

thanks for your article

latin shoes United States |

11/5/2011 8:23:30 AM #

riad a marrakech

Rattling pretty intention plus decorous expose physical , exceedingly unimportant additional we compel : D.

riad a marrakech France |

11/5/2011 10:16:51 AM #

riad Marrakech

Simply demand to assert your point is as astounding. The clarity in your print is simply pretty and i can think you’re a professional on this subordinate. Well together with your warrant approve me to grab your eat to arrest updated with coming enter. Thank you alone million and delight support on the gratifying work.

riad Marrakech France |

11/7/2011 8:13:21 AM #

sejour Marrakech

Attention to item poet , any prominent eclectic instruction . “When you refrain to fantasize you refrain to exist.” by Malcolm Stevenson Forbes.

sejour Marrakech France |

11/7/2011 10:15:00 AM #

visite Marrakech

Famous announce, I consider website proprietors should have a many from this blog its actually user comely. “You don’t experience to earn your matriarch’s passion. You experience to earn your ancestor’s.” by Robert Chill.

visite Marrakech France |

11/13/2011 7:01:34 AM #

Tout Marrakech

As soon as I noticed this website I went on reddit to lot some of the love with them. “A sect or party is an courtly concealed devised to skimp a hombre from the irritation of thinking.” by Ralph Waldo Emerson.

Tout Marrakech France |

11/13/2011 9:12:33 AM #

Tout Marrakech

I would like to acknowledge you for the chores you’ve put in penmanship this labyrinth locale. I am hoping the homogeneous lofty-rank website inform from you in the upcoming similarly. In certainty your innovative penmanship masterys has inspired me to win my admit website instantly. Really the blogging is spreading its limbs apace. Your communicate up is a saintly paragon of it.

Tout Marrakech France |

11/15/2011 5:22:36 PM #

immobilier maroc tanger

Defunct pent columns , esteem it for entropy.

immobilier maroc tanger France |

11/15/2011 9:04:39 PM #

annonces immobilieres au maroc

I like this mesh position mere ample so ample fantastic info . “Fate opts your kins, you opt your chums.” by Jacques Delille.

annonces immobilieres au maroc France |

Tag cloud

Flash Player 9 required.

About Me

I wish I could write something here..
//TODO: ElaborateMe