Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to pass authentication parameter of web service by soap header. I have tried below code

C#
AuthWebService.WebService webService = new AuthWebService.WebService();
    AuthWebService.AuthHeader authentication = new 
                              AuthWebService.AuthHeader();

    authentication.Username = "test";
    authentication.Password = "test";
    webService.AuthHeaderValue = authentication;


In above code i did not get webService.AuthHeaderValue property when i try.

this code does not work in windows application. it is working web application. In web application it gives me option to add web reference but windows application it gives only add reference option. Anyone have idea about this? how to use it in windows application??

please provide some solution.
Posted
Updated 29-Aug-13 0:47am
v2
Comments
VishwaKL 27-Aug-13 5:19am    
Use impersonation if you want to the authenticated Windows user

Try this


using (((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate())
{
WebProxy procy = new WebProxy("proxy",true);
proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
string s = proxy.ServiceMethod();
}
Anuja Pawar Indore 27-Aug-13 6:18am    
Have you included System.Web.Services.WebService
Jackidada 27-Aug-13 8:02am    
But client side not getting System.web.Services.Webservice.

1 solution

 
Share this answer
 
v2
Comments
Jackidada 27-Aug-13 8:03am    
this link i have tried. from this i got the problem. it is not working for client side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900