WebService Credentials

S

Steve B.

Hi,

I'm building an application that require passing credentials to a web
service, and to query the WS in order to fill a GridView.

I've build the WS which works fine, I've created a web application and I
referenced the WS.
I've put a ObjectDataSource on the page, and configured it to use a specific
method of the WS (in the select tab).

When I run the application, I get a 401 error.
Where can I pass the credential object to my webservice proxy ?

Thanks,
Steve
 
Joined
Sep 11, 2006
Messages
1
Reaction score
0
The way I did it was:

Code:
MyWebService proxy = new MyWebService();
CredentialCache webservCredentials = new CredentialCache();

webservCredentials.Add(new Uri("http://server.com/"), "Digest", new NetworkCredential("guest", "guest", "server.com"));
proxy.Credentials = webservCredentials;

DataSet ds = proxy.MyMethod();

gv = ds.Tables[0];
gv.DataBind();

Where gv is my GridView control, and my web service is protected using Digest authentication.

I'm not sure how to pass credentials via an ObjectDataSource so I simply didn't use one.

Hope that helps.

P.S When your GridView is bound programmatically, then you lose the automatic sorting and paging. To be able to do that you need to write your own OnSorting event handler etc
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top