人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

運用webservice處理多系統登陸問題

運用webservice處理多系統登陸問題

更新時間:2022-07-29 文章作者:未知 信息來源:網絡 閱讀次數:


首先新建一個空項目project1  添加一個WebForm1  寫如下代碼  private void Page_Load(object sender, System.EventArgs e)
  {
   if(Session["UserID"] != null)
   {
    this.Response.Write(Session["UserName"].ToString());
   }
   else
   {
    this.Response.Write("你輸入的用戶名或密碼不正確!");
   }
  }  在項目名稱上點又鍵,填加一個新webservie Login.asmx  代碼文件如下  using System;
  using System.Collections;
  using System.ComponentModel;
  using System.Data;
  using System.Diagnostics;
  using System.Web;
  using System.Web.Services;  namespace WorkFlow
  {
   /// <summary>
  /// Login 的摘要說明。
   /// </summary>
   public class Login : System.Web.Services.WebService
   {
    WorkFlowWebUI.PortalLogin.FrameworkService loginService = new WorkFlowWebUI.PortalLogin.FrameworkService();
    public Login()
    {
     //CODEGEN:該調用是 ASP.NET Web 服務設計器所必需的
    InitializeComponent();
    }  #region Component Designer generated code
 
  //Web 服務設計器所必需的
  private IContainer components = null;/// <summary>
  /// 設計器支持所需的方法 - 不要使用代碼編輯器修改
  /// 此方法的內容。
  /// </summary>
  private void InitializeComponent()
  {
  }   /// <summary>
  /// 清理所有正在使用的資源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if(disposing && components != null)
   {
    components.Dispose();
   }
   base.Dispose(disposing); 
  } 
  #endregion  [WebMethod(EnableSession=true)]
  public bool LoginMethod(string userName,string password)
  {
      if(userName == "admin" & password== "admin")
      {
       Session["userName"] = "admin"       return true;            }      return false;
 }
  }}  再建一個新web項目,WebProject1  添加Login的web引用,并在webForm1中調用LoginMethod,如果返回值為true重定向到project1的WebForm1.aspx  這里需要注意兩點  一:在webService的特性里面需要加入(EnableSession=true)的描述  二:如果你是現在已經有的web項目將不允許你向其中添加新的webservice,這時候你要先在其它位置建立一個webservie文件,然后在你的項目里面添加這個現有文件就可以了

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 苍南县| 基隆市| 博罗县| 河间市| 高尔夫| 乌拉特中旗| 丰宁| 冕宁县| 莱西市| 喜德县| 潞西市| 喀什市| 武义县| 奉新县| 三河市| 宣汉县| 常德市| 吉木萨尔县| 平果县| 保靖县| 柘荣县| 龙陵县| 罗甸县| 项城市| 孟州市| 当涂县| 赣榆县| 噶尔县| 茌平县| 东辽县| 博乐市| 兴安盟| 廉江市| 江津市| 唐山市| 屏山县| 保山市| 天长市| 抚顺县| 柳州市| 古蔺县|