扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:编译:挽留刀 来源:yesky 2007年11月8日
关键字: Windows
An unhandled exception of type 'System.Net.WebException' occurred in system.web.services.dll Additional information: The request failed with the error message: -- <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href='/HttpSessionState/(l2z3psnhh2cf1oahmai44p21)/service1.asmx'>here</a>.</h2> </body></html> |
An unhandled exception of type 'System.InvalidOperationException' occurred in system.web.services.dll Additional information: Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message: … |
' 同时使用基于Cookie和Cookie的Session Private Cookies As System.Net.CookieContainer Private webServiceUrl as Uri Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim proxy As New localhost.Service1() Dim ret As Integer ' 设置proxy类的Cookie容器 If Cookies Is Nothing Then Cookies = New System.Net.CookieContainer() End If proxy.CookieContainer = Cookies ' 设置proxy类的URL If webServiceUrl Is Nothing Then webServiceUrl = New Uri(proxy.Url) Else proxy.Url = webServiceUrl.AbsoluteUri End If Try ret = proxy.IncrementSessionCounter() Catch we As WebException ' 如果我们想检测HTTP状态码 ' 那么就需要一个HttpWebResponse类的实例 If TypeOf we.Response Is HttpWebResponse Then Dim HttpResponse As HttpWebResponse HttpResponse = we.Response If HttpResponse.StatusCode = HttpStatusCode.Found Then ' 这是一个“302 Found”响应,提示用户是否进行重定向 If MsgBox(String.Format(redirectPrompt, _ HttpResponse.Headers("Location")), _ MsgBoxStyle.YesNo) = _ MsgBoxResult.Yes Then ' 用户选择Yes,重新尝试新的URL webServiceUrl = New Uri(webServiceUrl, _ HttpResponse.Headers("Location")) Button1_Click(sender, e) Return End If End If End If Throw we End Try Label1.Text = "Result: " & CStr(ret) End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者