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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -