标签:isa summary 组件 eth 调用 header sharp generic org
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
/// <summary>
/// WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
public WebService()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
public myheader _myheader;
private bool IsAuthorization()
{
bool result = false;
if (this._myheader != null) {
if(this._myheader.username == "lzc" && this._myheader.pwd == "lzc")
{
result = true;
}
}
return result;
}
[WebMethod]
[SoapHeader("_myheader")]
public string HelloWorld()
{
if (IsAuthorization())
{
return "Hello World";
}
else
{
return "验证不通过";
}
}
public class myheader : SoapHeader
{
public string username { get; set; }
public string pwd { get; set; }
}
}
标签:isa summary 组件 eth 调用 header sharp generic org
原文地址:https://www.cnblogs.com/zacklau/p/9538261.html