Restricting webservice..

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
My prj has a login form(Login.aspx).It uses Form authentication(Credential
stored in web.config).Once user is authenticated,it redirects to a
webservice(service.asmx)
that has a method that does some database operation.

this is the code..

if (FormsAuthentication.Authenticate(UsrNameTextBox.Text, PwdTextBox.Text))
Response.Redirect("Service.asmx");
else
FormsAuthentication.RedirectToLoginPage();


My problem is,when the user types the asmx url directly in the
browser(localhost/service.asmx...) ,it should prompt for authentication and
if its not a valid user,i need to redirect him to login page

any suggestion,on how to do this???

Thnks
 
Ann,

The way that ASP.NET handles authentication for web sites is completely
different from how authentication/authorization is handled on web services.
If anything, you should be using WSE (Web Services Enhancements) or Windows
Communications Foundation to handle your security needs.

Also, if these classes are in the same web app, then why are you
redirecting to the web service? Why not just call the class directly?

Hope this helps.
 
Back
Top