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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Name

Status
Not open for further replies.

aTekTipsUser

Programmer
Nov 8, 2004
68
US
I am using ASP.net and I am trying to get the Windows user name. I user User.Identity.Name. I had it working by setting the IIS Authentication mode to Integrated Windows Authentication and not allowing Anonymous access. But when I posted it to the live server and tried accessing it through the web, I could not get into the web site. It was giving me the error:

You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a header field that the Web server is not configured to accept.

Is there another way to get the user name or can you let me know why I am getting this message on the live server. Thanks for your help!
 
Have you tried using simple HTTP header server variable technique from good old ASP days?
LOGON_USER server vaiable returns "DOMAIN/USER"

dim showid
dim MyPos
showid=request.servervariables("LOGON_USER")
MyPos= Len(showid) - (Instr (1, showid,"\",1))
logon = Right(showid, MyPos)




Thanks


Yogesh
 
Thanks for replying!
Yes, I tried the request.servervariables("LOGON_USER"). That only works when I set the mode to Integrated Windows Authentication. But when I set the mode to Integrated Windows Authentication on the live server, I get the error:

You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a header field that the Web server is not configured to accept.
 
then configure your webserver to accept that header field

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top