.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> XML >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

User.Identity.IsAuthenticated property to determine if the HTTP Module has authenticated the user.

Posted By:Jegan R       Posted Date: November 03, 2010    Points: 15    Category: XML    URL: http://www.dotnetspark.com  

The following code example is an XML Web service that defines the Authentication SOAP header that a client must pass. The XML Web service does not have to do the authentication. Rather, it can inspect the User.Identity.IsAuthenticated property to determine if the HTTP Module has authenticated the user.
 

using System;
using System.Web.Services;
using System.Web.Services.Protocols;
 
public class Authentication : SoapHeader {
  public string User;
  public string Password;
}
 
public class SecureWebService : WebService{
  public Authentication authentication;
 
  [WebMethod]
  [SoapHeader("authentication")]
  public string ValidUser(){
    if (User.IsInRole("Customer"))
      return "User is in role customer";
 
    if (User.Identity.IsAuthenticated)
      return "User is a valid user";
    return "not authenticated";
  }
}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend