How to authenticate web service? When you enter the web
service url in browser it should ask username and password.
After entering the un&pwd we have to show its methods and
service description(wsdl).

Answer Posted / gp_bellamkonda

If external clients want to access our webservices,We can
declare and use our own keys like userid,password and
domain in web.config.

TYPE IN WEB.CONFIG
=============
<appSettings>
<add key ="UserID" value ="User123"/>
<add key ="Password" value="Pwd@123"/>
<add key="Domain" value ="ABC"/>
</appSettings>

and
IN CODE
=======
try
{
ISAuthenticatedUser = new AuthenticateUsers
().Authenticate(LoginUserId, LoginPassword, "DEVDCDOM");
if (ISAuthenticatedUser == "Error")
returnMSg = "Application error has
occured.Please check log files for details.";
else if (ISAuthenticatedUser
== "Authentication Failed")
returnMSg = "USer not Authorized.";
}
catch (Exception ex)
{
throw ex;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is better python or c#?

630


What is the size of a decimal?

796


How to put assembly in gac?

698


What is an ienumerable in c#?

708


Is type nullable c#?

677


How do I calculate relative time?

688


What are data types in C#?

732


What is the full form of GAC? Explain its uses?

756


What is desktop example?

677


What is xamarin used for?

692


What are the Types of assemblies that can be created in dotnet

869


What does exclamation mark mean c#?

737


Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?

691


How to properly clean up excel interop objects?

684


Can a class have more than 1 destructor?

719