我正在尝试从 Web 服务实例化一个对象,然后调用我的方法并将当前页面的 HttpContext 传递给它。
它不允许我通过 HttpContext
为什么?谢谢
''''''''''''''''''service
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Sub doThis(ByVal HC As HttpContext)
'do something
End Sub
End Class
''''''''''''''''''page
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As test2.WebService = New test2.WebService
s.doThis(HttpContext.Current)
End Sub
End Class