Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am writing a web application for

Status
Not open for further replies.

mobius1983

Technical User
Jul 7, 2002
45
GB
I am writing a web application for my company that will run on our intranet using asp. I need it to get the visitors nt username to ensure that they only change their own details. I have tried using server variables and it always returns blank or the username iusr_servr (servr being out intranet server)

I have heard people speaking about challenge/response but am unsure what this means. Can anybody help; I have been searching the internet for the last week and am getting desperate!

Could this possibily run client side and then either post the result or place it in a cookie to be read by my asp program?

Any help would be a life saver!

Cheers.
 
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
response.Write (&quot;<br>Server Name &quot; & &quot;<b>&quot; & Request.ServerVariables(&quot;server_name&quot;) & &quot;</b>&quot;)
response.Write (&quot;<br>Login User &quot; & &quot;<b>&quot; & Request.ServerVariables(&quot;logon_user&quot;) & &quot;</b>&quot;)
%>
</TABLE>
</BODY>
</HTML>
 
thanks for your response, unfortunatley server variables are not working either returning blank or the username logged on to iis on the webserver, i need to go one level deeper and get the original username.
 
First of all this only works if the user is using IE. Secondly it appears you must first get the &quot;LOGON_USER&quot; in server side Java Script before it is available to VBScript. I don't know why. Once the following code is run you can get the &quot;LOGON_USER&quot; in VBScript.

<SCRIPT LANGUAGE=&quot;JScript&quot; RUNAT=&quot;Server&quot;>

// Script must be placed before any headers have been sent
// to browser. Either turn on buffering or place this code
// at the top of the page.

// Send access denied if LOGON_USER variable is empty;


function Session_OnStart(){

var objBrowsCap ;
objBrowsCap = Server.CreateObject(&quot;MSWC.BrowserType&quot;);
if (objBrowsCap.browser != &quot;IE&quot;) {
Response.Buffer = true;
Response.clear();
Response.Redirect(&quot;error.html&quot;);

}

if (Request.ServerVariables(&quot;LOGON_USER&quot;) == &quot;&quot;)
{
Response.Status = &quot;401 access denied&quot;;
Response.End(); // End transmission so user can not cancel.
}

}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top