分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

WebService 之 SoapHeader

发布时间:2023-09-06 02:12责任编辑:胡小海关键词:Web
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; } ???}}

  

WebService 之 SoapHeader

原文地址:https://www.cnblogs.com/zacklau/p/9538261.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved