By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,498 Members | 1,558 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,498 IT Pros & Developers. It's quick & easy.

Changing user when using Windows Authentication?

P: 2
I am using Windows Authentication and I am trying to determine how to swap users (like when a supervisor needs to temporarily boost the priviledges of a session by logging into his own account and then punting back)

I am trying to do this by adding a LinkButton that does the following:

Response.StatusCode = 401;
Response.End();

This *works* but it pops up the login screen 3 times before it settles down with the new credentials (I can enter the user/pass the first time and then just hit Ok and other two times because it comes back up already filled out.)

So two problems: the multiple prompting and the fact that when it finishes it leaves me on a blank screen and I need to navigate somewhere useful to do anything. Even hitting Refresh just reposts and puts me back on the blank screen after once again prompting 3 times for my credentials.

Any ideas would be awesome! Thanks!
Sep 16 '09 #1
Share this Question
Share on Google+
2 Replies


P: 2
I found this code somewhere and it seems to do the trick.

Response.StatusCode = 401;
Response.StatusDescription = "Unauthorized";
Response.SuppressContent = true;
HttpContext.Current.ApplicationInstance.CompleteRe quest();

However, now I need to refresh the screen after doing this to update the user preferences. I have tried doing a Response.Redirect(..) and adding:
Response.AddHeader("Refresh", string.Format("0;URL={0}", Request.Url.ToString()));

No dice though... if I turn the SupressContent back off, then I get the mutliple login pop-ups again. I'm about ready to set a Session variable and have a timer to check it so that I can invoke a refresh from a different postback after this postback has completed. I think that has promise but feels kind of cludgy.
Sep 16 '09 #2

P: 1
its working but i can not stop the 3 time login popup window.
please help me

Thanks

Surendra
Jan 27 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.