Authentication for Web Services

F

Forch

Hi guys....

I have a web service enabled which only allows a fixed number of users
access. From another application which uses this service as a web
reference, I need to programatically set the username and password for the
user who will access the web service from the remote machine.

I'm sure that there is an easy way to do this. Can anyone lead me in the
right direction?

Thanks!

Mark
 
J

Joe H

Dim webMethod as WebMethodReference

Dim oCreds as New NetwordCredential()
With oCreds
.UserName = "user name here"
.Password = "password here"
.Domain = "domain name here"
End With

webMethod.Credentials = oCreds

on the other hand, if you simply want to pass the credentials of the
user...then you can use:

webMethod.Credentials = System.Net.CredentialCache.DefaultCredentials
 
F

Forch

Thanks Joe... that's perfect!

Forch

Joe H said:
Dim webMethod as WebMethodReference

Dim oCreds as New NetwordCredential()
With oCreds
.UserName = "user name here"
.Password = "password here"
.Domain = "domain name here"
End With

webMethod.Credentials = oCreds

on the other hand, if you simply want to pass the credentials of the
user...then you can use:

webMethod.Credentials = System.Net.CredentialCache.DefaultCredentials
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top