Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > using Windows authentication within intranet

Reply
Thread Tools

using Windows authentication within intranet

 
 
Ethan Shayne
Guest
Posts: n/a
 
      11-15-2004
I would like to set up a web service to use Windows authentication. I
understand how to do this in a situation where the client passes a
NetworkCredential instance, and have the web server authenticate for
me using Windows authentication.

However, in this particular case I know that the client will be within
the same intranet and on the same Windows domain as the web server.
And I want to have my web server authenticate based on the Windows
login already in use by the client application.


Here's what I've tried so far:
I started with setting <authentication mode="Windows"/> and <identity
impersonate="true"/> in my web.config file. I then set up IIS to turn
off anonymous access, and enable Windows authentication.

In my web method (C#, if it matters), I have code to look at
this.User.Identity.Name.

In my client application, I was able to successfully set Credentials
on my proxy object to a new NetworkCredential instance. When I use
this client application to call my web method, the web method
correctly reports this.User.Identity.Name as the one I set in the
NetworkCredential instance. And the web method call also correctly
fails if the username and password I set in the NetworkCredential
instance are not valid on this domain.

However, here's my problem: I had to fill in the NetworkCredential
instance in my client application with a username and password. What I
want is to pass a NetworkCredential instance representing the
currently logged-in user. In other words, if "freduser" already logged
into Windows and ran the client application, I want my web method to
report that this.User.Identity.Name is "freduser" - without having to
prompt the user for their password again in the client application.
Since I can't get the current user's password programmatically, I
don't know how to create the NetworkCredential instance without
prompting.

Can anyone tell me if there's a way to accomplish this?

Thanks,
Ethan
 
Reply With Quote
 
 
 
 
Tom Porterfield
Guest
Posts: n/a
 
      11-15-2004
Ethan Shayne wrote:
> However, here's my problem: I had to fill in the NetworkCredential
> instance in my client application with a username and password. What I
> want is to pass a NetworkCredential instance representing the
> currently logged-in user. In other words, if "freduser" already logged
> into Windows and ran the client application, I want my web method to
> report that this.User.Identity.Name is "freduser" - without having to
> prompt the user for their password again in the client application.
> Since I can't get the current user's password programmatically, I
> don't know how to create the NetworkCredential instance without
> prompting.
>
> Can anyone tell me if there's a way to accomplish this?


Set the credentials on your proxy object to
System.Net.CredentialCache.DefaultCredentials.
--
Tom Porterfield
 
Reply With Quote
 
 
 
 
Ethan Shayne
Guest
Posts: n/a
 
      11-16-2004
Tom Porterfield <> wrote in message news:<ON#pa$>...
> Ethan Shayne wrote:
> > However, here's my problem: I had to fill in the NetworkCredential
> > instance in my client application with a username and password. What I
> > want is to pass a NetworkCredential instance representing the
> > currently logged-in user. In other words, if "freduser" already logged
> > into Windows and ran the client application, I want my web method to
> > report that this.User.Identity.Name is "freduser" - without having to
> > prompt the user for their password again in the client application.
> > Since I can't get the current user's password programmatically, I
> > don't know how to create the NetworkCredential instance without
> > prompting.
> >
> > Can anyone tell me if there's a way to accomplish this?

>
> Set the credentials on your proxy object to
> System.Net.CredentialCache.DefaultCredentials.


Thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Intranet Application Using Windows Authentication Mckinsey ASP .Net 0 01-03-2006 08:00 AM
ASP:NET on Intranet - Windows Authentication to Access SQL Server andy ASP .Net 2 11-16-2005 07:15 PM
Intranet windows authentication Rafi Daskalo via .NET 247 ASP .Net Security 1 08-04-2004 01:31 PM
Intranet and Integrated Windows Authentication Andrew ASP .Net Security 3 06-23-2004 10:47 PM
Intranet and Integrated Windows Authentication Andrew ASP .Net 4 06-22-2004 11:22 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57