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

explain the features of static/shared classes.

509


What are partial types in c#?

497


Explain what is copy constructor?

559


How do you define a predicate?

490


What is the difference between Singleton design pattern and Factory design pattern?

564






What is session variable in c#?

567


Can we make a Static Constructor Parameterized? Give Reason with your answer

556


What is the difference between constants and read-only?

481


What is the namespace for datatable in c#?

502


Is array a list?

496


What is difference between managed and unmanaged code?

502


Which programming language is best for desktop applications?

467


Explain the different ways a method can be overloaded?

458


What is c# windows form application?

504


Explain the difference between const and static read-only?

514