blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Rory Street's Blog

Do you want fries with that?

Using custom membership providers with custom login controls

Recently I had to create a custom membership provider for a client which required authentication through two user ids and fragments of the users password. You can understand that using the Logon control that comes out of the box with ASP.NET 2.0 will not accommodate this membership provider, so I went about creating my own form control to submit the data to the membership provider I created.

All worked fine however I couldn't for the life of me figure out how to actually set the users Context.User.Identity.Name which will basically allow you to identify the user once logged in. This is something the log in control does automatically for you that you don't usually have to think about, anyway the simple line of code is below.

FormsAuthentication.SetAuthCookie(userName, false)

Published 04 June 2007 20:11 by rory.street
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Hendra Ariestha Setiawan said:

Thanks! Work like a charm!
July 10, 2007 06:30

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems