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
How many kinds of elements an array can have?
What is object array in c#?
How can i Spawn a Thread
what are the contents of an assembly ?
What is the main method in c#?
Overloaded constructor will call default constructor internally?
What is the difference between select and selectmany?
What is thread safe in c#?
What is the max value of int32 in c#?
Explain about Serialize and MarshalByRef?
Define parsing? Explain how to parse a datetime string?
What is a cs file?
What is application c#?
What is difference between ilist and list?
Difference between call by value and call by reference in C#?