Windows Authentication : switching user

S

Simon

Hi,

In my custom asp.net application (authentication = windows), I've
tried to force a reauthentication after a button click by returning
Response.StatusCode = 401;
However instead of reauthenticating once, I'm asked for 3 times
despite the correct userid and password.

Is this due to certain configurations? Or is there any other
alternative available to achieve the same effect?

TIA,
Simon
 
J

Jim Cheshire [MSFT]

Simon,

What does your code look like?

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
 
S

Simon Turmel

It's really simple. I use an hyperlink to reload the page with a new URL
parameter and then in my web page codebehind, I check if the parameter
is not null. If so, I send a 401 to force the reauthentication.


if( Request.QueryString["ChangeUser"] != null )
{
Response.StatusCode = 401;
}

I get the windows authentication dialog, but I have to click OK 3 times
before it goes away. Apart from this, everything is fine, the user is
changed.


TIA,
Simon
 
J

Jim Cheshire [MSFT]

Simon,

I'll do some more looking as soon as I get a chance, but just right off, it
could be due to the fact that you're not doing a Response.End after sending
the status. For example:

if(Request.QueryString["ChangeUser"] != null)
{
Response.Status = 401;
Response.End;
}

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.


--------------------
 
S

Simon Turmel

Hi,

I tried with Response.End();, but still no success. I'll be waiting for
your next idea.

Thanks in advance,

Simon
 
J

Javier Miranda

Simon

Are you sending a POST or a GET. Try a GET if you are sending a POST

Hope it helps

-Javier M
 
S

Simon Turmel

There is no form here. Only a <a href=...>, so it is automatically a GET
in this case.

Simon
 
J

Javier Miranda

Simon

It seems like a problem with the URL parameter or HTTP headers. Can you clear/save the IIS log and paste it here after you recreate the behavior

If you do so, remove any company data like IP address and ports before submitting it

Hope it helps

-Javier M.
 
S

Simon Turmel

Here is my log file when I click to change the user. I think you should
copy it to a notepad for a better reading.

TIA,
Simon


2004-04-06 15:33:22 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:22 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:22 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 5 0
2004-04-06 15:33:23 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:23 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 5 0
2004-04-06 15:33:23 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:23 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 5 0
2004-04-06 15:33:23 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET /PolygonIntranet/Home.htm ChangeUser=Y
<PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 5 0
2004-04-06 15:33:24 <IP> GET /PolygonIntranet/Templates/FrameHeader.aspx
NRMODE=Published&NRORIGINALURL=%2fPolygonIntranet%2fHome.htm&NRNODEGUID=
%7b57AB4E5A-09BA-46A6-B893-4EDA82BFDD39%7d&NRCACHEHINT=ModifyLoggedIn&Ch
angeUser=Y <PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/Templates/FrameNavigation.aspx
NRMODE=Published&NRORIGINALURL=%2fPolygonIntranet%2fHome.htm&NRNODEGUID=
%7b57AB4E5A-09BA-46A6-B893-4EDA82BFDD39%7d&NRCACHEHINT=ModifyLoggedIn&Ch
angeUser=Y <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/Templates/FrameNavigation.aspx
NRMODE=Published&NRORIGINALURL=%2fPolygonIntranet%2fHome.htm&NRNODEGUID=
%7b57AB4E5A-09BA-46A6-B893-4EDA82BFDD39%7d&NRCACHEHINT=ModifyLoggedIn&Ch
angeUser=Y <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/NR/exeres/57AB4E5A-09BA-46A6-B893-4EDA82BFDD39,frameless.htm
ChangeUser=Y <PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 0
2004-04-06 15:33:24 <IP> GET /PolygonIntranet/Styles/VikingMenu.css -
<PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 0
2004-04-06 15:33:24 <IP> GET /PolygonIntranet/Styles/Viking.css - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 0
2004-04-06 15:33:24 <IP> GET /PolygonIntranet/Images/VikingLogo.JPG -
<PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 64
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/CommonClient.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/CommonClient.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/CommonClient.js - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Windows.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Windows.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Windows.js - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 64
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Console.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Console.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Console.js - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 64
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/OptionsClient.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/OptionsClient.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/OptionsClient.js - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 64
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/JavaScriptUIStrings.js - <PORT> -
<IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/JavaScriptUIStrings.js - <PORT> -
<IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/JavaScriptUIStrings.js - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 64
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Dates.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 2 2148074254
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Dates.js - <PORT> - <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
401 1 0
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/CMS/WebAuthor/Client/Dates.js - <PORT>
TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 64
2004-04-06 15:33:24 <IP> GET
/PolygonIntranet/Templates/FrameNavigation.aspx
NRMODE=Published&NRORIGINALURL=%2fPolygonIntranet%2fHome.htm&NRNODEGUID=
%7b57AB4E5A-09BA-46A6-B893-4EDA82BFDD39%7d&NRCACHEHINT=ModifyLoggedIn&Ch
angeUser=Y <PORT> TESTSERVER\administrator <IP>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)
200 0 0
 
J

Javier Miranda

Simon

I am just looking the log. Is this OK?... " /PolygonIntranet/Home.htm ChangeUser=Y
Notice that the page is HTML. Is ASP.NET processing the file including code?

I noticed many 401... what a discovery ah!, but take a look at the parameter. Still there. Can you try a sesion variable instead of parameter
 
S

Simon Turmel

It is processing the ASP.net code, it's a web application working with
Microsoft CMS. The aspx are the templates that htm use. I'll try with a
session variable and tell you the result soon.

Simon
 
S

Simon Turmel

I have now tried with a session variable and I have the same problem. If
anyone has an idea, please post it.


TIA,
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top