Context.User.Identity issue??
-
Hi, Environment - VB.NET, ASP.NET, SQL Server 2000. I have two folders in my web application. One is PUBLIc and other is SECURE. I am using Forms authentication to access files in SECURE folder and PUBLIC files are available to all. In one of the files of PUBLIC folder, Based on whether the user is authenticated or not, I want to display/hide certain contents. How can make use of "Context.User.Identity" to do that? I want to avoid Session Variables as using them will defeat the purpose of Forms Authentication. Please advice. Thanks Pankaj Follow your goals, Means will follow you ---Gandhi---
-
Hi, Environment - VB.NET, ASP.NET, SQL Server 2000. I have two folders in my web application. One is PUBLIc and other is SECURE. I am using Forms authentication to access files in SECURE folder and PUBLIC files are available to all. In one of the files of PUBLIC folder, Based on whether the user is authenticated or not, I want to display/hide certain contents. How can make use of "Context.User.Identity" to do that? I want to avoid Session Variables as using them will defeat the purpose of Forms Authentication. Please advice. Thanks Pankaj Follow your goals, Means will follow you ---Gandhi---
What you could do is test to see if the user is authenticated:
Label1.Visible = Context.User.Identity.IsAuthenticated;
Also, just as a side question, how will using Session variables defeat the purpose of Forms Authentication? HTH, Bill P. Oakland, CA -
What you could do is test to see if the user is authenticated:
Label1.Visible = Context.User.Identity.IsAuthenticated;
Also, just as a side question, how will using Session variables defeat the purpose of Forms Authentication? HTH, Bill P. Oakland, CA -
Thanks Bill. Well, If we still use Session variable, instead Context.User.Identity.IsAuthenticated, then it does. Doesn't it? :) Follow your goals, Means will follow you ---Gandhi---
mittalpa wrote: Thanks Bill. Well, If we still use Session variable, instead Context.User.Identity.IsAuthenticated, then it does. Doesn't it? Nope... The Context.User.Identity is a System.Security.Principal.IIdentity object. It is not stored in session. Using Session state variables in your app will not invalidate your Forms authentication at all. But that is more O/T... ;) Gald I could be of assitance :) HTH, Bill P. Oakland, CA