asp.net mvc 3 - How to force an MVC application to populate the User.Identity.Name value when using Windows Authentication -


i have mvc 3 application used both anonymous , authenticated users.

this accomplished configuring iis authentication mode enable both anonymous , windows authentication, , setting authentication mode web.config setting "windows" , applying custom authorization attribute selectively actions require authentication check.

the issue in actions don't need apply attribute (so anonymous users can access too), in case admin user browsing it, want retrieve user.identity.name value.

the application behaving unpredictably, in instances, once user has been authenticated in previous action, user.identity.name property remains available rest of user's session. however, in other instances, it's coming empty string.

so, how tell application "go , authenticate user"? if authorize attribute can force authentication of user, how can achieve same effect on demand within action?

thanks help,

m

if authorize attribute can force authentication of user, how can achieve same effect on demand within action?

by doing same authorizeattribute does:

return new httpunauthorizedresult(); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -