windows Authorization, ASP.NET

liunx

Guest
I'm using User.Identity.Name to get the logged in users username. It works fine most of the time but sometimes i get an error


[NullReferenceException]
System.Security.Principal.WindowsIdentity._ResolveIdentity(IntPtr userToken) +0
System.Security.Principal.WindowsIdentity.get_Name() +71
System.Web.Configuration.AuthorizationConfigRule.IsUserAllowed(IPrincipal user, String verb) +106
System.Web.Configuration.AuthorizationConfig.IsUserAllowed(IPrincipal user, String verb) +81
System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) +181
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87

and when I refresh the page it works fine. But sometimes the first time (or sometimes after being idle for 10 min) the page is giving this error.. What is the problem????????????

I don't know if something is wrong with the settings? It works sometimes, and sometimes it doesn't work. When I refresh the page it definetly works at that time


PLEASE HELP ME........thats because you are not attempting to verify that the user is logged in correctly...

if(Page.User.IsAuthenticated)
{

}I tried this but I still have the same problem, It works after I refresh the page. And when I stay idle again a few minutes it stops working, unless if I refresh again.
Should I change something in Web.Config file????what ? You are saying it works but doesn't work?
 
Back
Top