consuming web service in asp.net application - authorization problem

G

gusTbus

Hi!

I have an authentication problem when trying to access web services on
my local intranet. The web service requires windows authentication.

I want to use asp.net with c# to do this, but every time I try I
allways get
error message "The request failed with HTTP status 401: Unauthorized"

It seem I am not able to pass my credentials trough to the web
service, even though I've included "myservice.Credentials =
CredentialCache.DefaultCredentials;" in the code and has turned
anonymous authentication off in the IIS manager for my application
that is running on localhost.

I do have authorization to use the web services, because when I
compile the same code in a windows appliction project, the service
works fine.

It seems to me that I have some configuration wrong, but being quite a
newbie to .NET web application development, I am clueless.

Hope that someone can help me,
Magnus
 
D

Dino Chiesa [Microsoft]

Magnus
Are you sure your webform (asp.net) app and your winforms app are using the
same credentials?

put this in your aspx :
<h6> <%= System.Security.Principal.WindowsIdentity.GetCurrent().Name %>
</h6>

and see what it says. Do the same thing in the winforms app. Are they the
same?

-Dino
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top