Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Override User.Identity.Name or Custom IIdentity

Reply
Thread Tools

Override User.Identity.Name or Custom IIdentity

 
 
Corker
Guest
Posts: n/a
 
      03-08-2010
Hi I am using the standard asp.net login control and it is currently working
well where my users can login with their email address and password.
I want to modify this so they can enter their email address or membership
number and password. I have a custom membership provider class where I check
the login details based on whether an email or number has been entered, again
this is fine.
Finally, my problem is that User.Identity.Name is whatever was entered in
the login box, I want this to always be an email address so can you suggest
how I can override this value?
I created a Custom Identity class and tried assigning that in Global.asax
Application_AuthenticateRequest, but it says it cannot resolve the type
MyNamespace.CustomIdentity. I'm not sure what to try next.
 
Reply With Quote
 
 
 
 
Joe Kaplan
Guest
Posts: n/a
 
      03-10-2010
You are close to getting this. The authenticate event on the ASP.NET
pipeline is the proper event to handle. Basically, you want your custom code
to run after the various authentication mechanisms like forms auth and
membership but before authorization takes place. Essentially, you want to be
the last handler of the Authenticate event. Here, you can swap out the
principal for whatever you want.

Your issue sounds like a simple problem related to type references where the
..NET framework cannot find your class by the name you tried to use for it.
This is a more generic issue that you should be able to figure out. Using
the object browser to find the real name of your type may be helpful.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
"Corker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi I am using the standard asp.net login control and it is currently
> working
> well where my users can login with their email address and password.
> I want to modify this so they can enter their email address or membership
> number and password. I have a custom membership provider class where I
> check
> the login details based on whether an email or number has been entered,
> again
> this is fine.
> Finally, my problem is that User.Identity.Name is whatever was entered in
> the login box, I want this to always be an email address so can you
> suggest
> how I can override this value?
> I created a Custom Identity class and tried assigning that in Global.asax
> Application_AuthenticateRequest, but it says it cannot resolve the type
> MyNamespace.CustomIdentity. I'm not sure what to try next.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom IIdentity object casting Random ASP .Net 0 01-25-2008 05:23 PM
Custom IIdentity w/ FormsAuthentication Spam Catcher ASP .Net 2 01-07-2006 04:17 AM
Stupid Question ? IIdentity Amar ASP .Net 1 12-07-2004 11:37 AM
IIdentity casting problem Craig Buchanan ASP .Net 4 02-24-2004 08:03 PM
Custom IIdentity class - how to set it? Tim Mulholland ASP .Net 6 02-24-2004 07:34 AM



Advertisments