Last post Sep 02, 2016 07:19 PM by march11
Sep 01, 2016 01:27 PM|hanspam|LINK
Im working on a project with Windows Authentication and Session States.
I have this code where i get the username, save it in a session and also in a label
using (var context = new PrincipalContext(ContextType.Domain))
var usr = UserPrincipal.FindByIdentity(context, User.Identity.Name);
if (usr != null)
Session["Application1_Data"] = usr.DisplayName;
lbl_Login.Text = usr.DisplayName;
After this I have the other pages where I receive the data of my session like this
if (Session["Application1_Data"] != null)
lbl_Login.Text = Session["Application1_Data"].ToString();
If the session expires I made a redirect to the index page where I define the session but I want to remain on the same page,
How do I show a authentication box to enter windows credentials? instead of going back to the first page and starting afresh
Sep 02, 2016 07:19 PM|march11|LINK
change this line of code to do what ever you want....
you could popup a login box to have the user re-authenticate.
There a few ways to deal with this