asp.net - httpContext User Identity -


i restrict user's access on website based on the user identity , used following code works fine in visual studio when publishing iis sending useridentity= null database.

dim httpcontext__1 httpcontext = httpcontext.current dim winidentity system.security.principal.windowsidentity = directcast(httpcontext__1.user.identity, windowsidentity) dim useridentity string = winidentity.name  hasaccess = getuserfromdb(useridentity) if hasaccess     ' restrictions on  else end if 

we need sure windows authentication enabled , anonymous authentication disabled.please see link


Comments

Popular posts from this blog

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -