.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT
Sandeep Singh

Home >> Forum >> Others >> Post New QuestionBookmark and Share Subscribe to Forum

Secure web service methods!

Posted By: Venky     Posted Date: October 29, 2008    Points:2   Category :Others

How can I secure my Web Service from caller calling it?

Let say I've a web service facing external customers (ie on Internet - I want my web method can call by only few peoples not by everyone?

I know its kind of open ended question - any idea highly appreciate


Author: Amit Mehra             
Posted Date: October 29, 2008     Points: 5   

you can use Windows Authentication to secure your webservices. This authentication you can configure in web.config file like this and its easy also

<authentication mode="Windows" />
<identity impersonate="true" />

Or like this

<identity impersonate="true" name="UserName" password="UserPassword"

Please "Mark As Answer " if this post help you.
Author: Venky             
Posted Date: October 30, 2008     Points: 5   

Thx Amit for your quick response.

so, lets say after adding your suggested solution, I rebuild my Web Service and deployed on webserver.

Now the client taken the new wsdl file, created a proxy and calling method with required parameters (if any) - now how this security will take effect?

can you please give me some use cases? - Thx in advance amit


Author: Amit Mehra             
Posted Date: October 30, 2008     Points: 5   

Hi Venky,
Once you have integated the windows authencation then in the client side you have to pass the user NetworkCredential like this

Service1 myService = new Service1();

myService .Credentials = new System.Net.NetworkCredential("UserName", "Password", "");

Please "Mark As Answer " if this post help you.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend