Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Windows domain based User Authentication

  Asked By: Jody    Date: Aug 20    Category: Asp.net    Views: 1709
  

I am trying to build an intranet application and I wanted to keep the
same login/password as in the domain network. Proceeding this way,
when I try to retrieve the user name I always get empty quotes. This
is the small code snippet I use on the initial Page Load.


System.Web.HttpContext context = System.Web.HttpContext.Current;
string abc = Context.User.Identity.Name;

Can anyone suggest if I am doing things the right way or any
references would also help.

Share: 

 

13 Answers Found

 
Answer #1    Answered By: Lu Fischer     Answered On: Aug 20

Why don't you try :

Session("LOGON_USER") instead

to retreive the user  name.

 
Answer #2    Answered By: Alfonso Martin     Answered On: Aug 20

u may use :

User.Identity.Name

 
Answer #3    Answered By: Chung Tran     Answered On: Aug 20

But what if I don't want to store session information?

 
Answer #4    Answered By: Salvador Alexander     Answered On: Aug 20

Use the code  you pasted as that is the correct way for an ASP.NET application.

Locate your Virtual Directory for that application  and remove anonymous perm for IIS to be able to authenticate the user  and return a correct value.

To store the information you would have to choose a storage type , Database (ms Access or SQL) and then create tables and columns to store the info there.

 
Answer #5    Answered By: Andrew Bryant     Answered On: Aug 20

Session("LOGON_USER") is the Windows Session. It is there anyway, so why not use it?

 
Answer #6    Answered By: Becky Baker     Answered On: Aug 20

Well I tried that but it also returns me an empty  string.

 
Answer #7    Answered By: Stacie Martin     Answered On: Aug 20

Did you have set the windows  authentification on the IIS server before or is it anonymous logon where everybody can open your application  ?

If it is not set you're always gonna get an empty  string for the user.

 
Answer #8    Answered By: Adali Fischer     Answered On: Aug 20

I have been able to work out with the System.Web.HttpContext object. Thanks a lot Monique and Carlos for the support as I am new to .NET and web  technologies. Have been a pure VC++ Win 32 programmer but with changing times....:)

 
Answer #9    Answered By: Olga Kates     Answered On: Aug 20

Ok can you explain what you have set in your Virtual directory settings?

 
Answer #10    Answered By: Milind Mishra     Answered On: Aug 20

Exactly as u had said. I checked permissions and set it to Windows authentication  mode.

 
Answer #11    Answered By: Jamie Williams     Answered On: Aug 20

Now what gves you the empty  string the LOGON_USER or the page.windows.identiy.name?

 
Answer #12    Answered By: Darrell Harvey     Answered On: Aug 20

You are absolutely right. The LOGON_USER still returns me an empty  string. Perhaps its more important to know the right way of doing things  than just getting things to work. I can post the code  if anybody want and it still returns an empty string  but identity.name doesn't. Thanks again!!!

 
Answer #13    Answered By: Bethany Hughes     Answered On: Aug 20

Never a problem post the code  and I ll get it to work for you so you have two options

 
Didn't find what you were looking for? Find more on Windows domain based User Authentication Or get search suggestion and latest updates.




Tagged: