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
What is a satellite assembly in c#?
How do you declare a variable in c#?
Explain about Serialize and MarshalByRef?
What is a hash table in c#?
What is int16?
How can you reference current thread of the method ?
What Happens In Memory When You Box And Unbox A Value-type?
Why are strings immutable in c#?
What does private void mean in c#?
Can namespace contain the private class?
Why do we need constructors?
How many types of constructors are available in c#?
Is struct object oriented?
Explain the difference between “constant” and “read-only” variables used in c#?
Can a abstract class have a constructor?