Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

I am working on windows service.
In windows service I am get the data from Web Service. So I add web reference and get the data successfully. It's working fine.

But what I do is Web Service Credentials are Hard Code it like below.
Test_Service tcsrvc = new Test_Service();
            Test[] tc;

            tcsrvc.Credential = new System.Net.NetworkCredential("username", "password");
            tc = tcsrvc.ReadMultiple(null, null, 0); 

In my question is if suppose this username is deactivated from windows LogIn this credentials are not working.

So how can acheive this? without hard code the credential.

or

how to pass windows LogIn username and password to this web service credentials?

Thanks in advance...........
Posted
Updated 26-Feb-13 3:09am
v3
Comments
Chris Reynolds (UK) 26-Feb-13 9:05am    
One thing to bear in mind that when a service starts there may well be no user logged on. Also a server could have multiple sessions, which user session's credentials would you use?
Bojjaiah 26-Feb-13 9:15am    
hi Chris,

I have also doubt about this question?

may be run administration credential (defaultly). so tell me briefly how can I achieve this question?

1 solution

 
Share this answer
 
Comments
Bojjaiah 27-Feb-13 8:16am    
Hi marcus,
thanks for replying it's working fine.

In my side 5 up :).

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