468,249 Members | 1,473 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

How to pass user credentials from a windows app to a web service?

Hi,
I'm trying to authenticate the user based on the credentials that I get
from the client app, but I'm getting empty string as user name. Can somebody
tell me if I'm doing anything wrong here. Thanks in advance!

Here is what I'm doing:

In the windows app, I've set the current security principal as
windowsprincipal

When I'm making to call to web service, I've tried both these things:

1)

MyService service = new MyService();

WebProxy proxy = new WebProxy(service.Url, true);
service.Proxy = proxy;

2)
MyService service = new MyService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials

In the vroot security settings for the web service, I've set the
authentication to IntegratedWindowsAuthentication

In the web.config of the web service, I've set to allow all users.
But in both cases, I'm not able to access the user name in the web service.
If I go to web service via the default UI, I'm able to access the username
fine.

Any help is greatly appreciated!
Nov 23 '05 #1
1 9926
You mentioned that you checked Integrated Windows Authentication, but did you
UNCHECK "Anonymous access"? If you allow Anon access at all, it will never
bother with the credentials.
Also make sure you web.config file has the following entries in it:
<authentication mode="Windows" />
<identity impersonate="true" />

Hope that helps,

John

"webserviceUser189" wrote:
Hi,
I'm trying to authenticate the user based on the credentials that I get
from the client app, but I'm getting empty string as user name. Can somebody
tell me if I'm doing anything wrong here. Thanks in advance!

Here is what I'm doing:

In the windows app, I've set the current security principal as
windowsprincipal

When I'm making to call to web service, I've tried both these things:

1)

MyService service = new MyService();

WebProxy proxy = new WebProxy(service.Url, true);
service.Proxy = proxy;

2)
MyService service = new MyService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials

In the vroot security settings for the web service, I've set the
authentication to IntegratedWindowsAuthentication

In the web.config of the web service, I've set to allow all users.
But in both cases, I'm not able to access the user name in the web service.
If I go to web service via the default UI, I'm able to access the username
fine.

Any help is greatly appreciated!

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by cmueller | last post: by
2 posts views Thread by elora_c | last post: by
4 posts views Thread by James | last post: by
3 posts views Thread by ssg31415926 | last post: by
reply views Thread by Eagle | last post: by
9 posts views Thread by webrod | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.