home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / Sharpdev / 099bsetup.exe / CSharpSessionStateWebService.xft < prev    next >
Extensible Markup Language  |  2003-09-21  |  1KB  |  53 lines

  1. <?xml version="1.0"?>
  2. <Template Originator="Christoph Wille" Language="C#" Created="6/13/2001" LastModified="6/13/2001">
  3.     
  4.     <TemplateConfiguration>
  5.         <Name>${res:Templates.File.C#.SecureCSharpWebService.Name}</Name>
  6.         <Icon>C#.File.WebFile</Icon>
  7.         <Category>C#</Category>
  8.         <LanguageName>C#</LanguageName>
  9.         <Description>${res:Templates.File.C#.SecureCSharpWebService.Description}</Description>
  10.     </TemplateConfiguration>
  11.     
  12.     <TemplateFiles>
  13.         <File DefaultExtension=".asmx" DefaultName="WebService">
  14.  
  15. <![CDATA[<%@ WebService Language="C#" Class="YourClassname" %>
  16. // created on ${Date} at ${Time}
  17. using System;
  18. using System.Web.Services;
  19.  
  20. public class YourClassname : WebService
  21. {
  22.     [ WebMethod(EnableSession=true) ]
  23.     public bool Login(string Username, string Password) 
  24.     { 
  25.         // replace with database code to your liking
  26.         if ("user" == Username && "pwd" == Password)
  27.         {
  28.           Session["LoggedIn"] = true;
  29.           return true;
  30.         }
  31.         else
  32.         {
  33.           Session["LoggedIn"] = false;
  34.         }
  35.         return false;
  36.     }
  37.         
  38.     [ WebMethod(EnableSession=true) ]
  39.     public bool IsUserLoggedIn()
  40.     {
  41.         object loggedIn = Session["LoggedIn"];
  42.         if (null != loggedIn) return (bool)loggedIn;
  43.         return false;
  44.     }
  45. }
  46. ]]>
  47.         </File>
  48.     </TemplateFiles>
  49.     
  50.     <FileOptions/>
  51.     
  52. </Template>
  53.