Set User Authenticated Programmatically  
Author Message

PostPosted: Common Language Runtime, Set User Authenticated Programmatically Top


I'm not sure if this is the right forum so excuse me in advance.

I'm developing a ASP.NET 2.0 C# Website having custom Membership, Role and SiteMap providers using the Login Control. This site should validate the user both through the login control and automatically when a specific key is set.

The usage of Login system is perfect, the Membership.ValidateUser is called , the Login events raise correctly and the SiteMapProvider renders the correct items.

The problem arise when I get the key; with this key the sw is able to get the user credentials but I'm not able to instruct the ASP.NET that the user is valid and let the Role and SiteMap providers work as they do when Login control is used. I tried to call directly the Membership.ValidateUser without results. I also used the FormsAuthentication members such as SetAuthCookie(..) and more of the System.Web.Security namespace

How to set the user authenticated status programmatically in my C# page

Could you please help me


.NET Development7  

PostPosted: Common Language Runtime, Set User Authenticated Programmatically Top


I solved the problem by myself.

With the key received the sw retrieves the user credentials then call the MemberShip.ValidateUser to validate it and if valid the FormsAuthentication.RedirectFromLoginPage is invoked. The code is like this in the Page_Load event

if (Membership.ValidateUser( Key , ""))


FormsAuthentication.RedirectFromLoginPage(url, false);