使用xmlhttp進行post資料到網頁,大部分網頁都可以,但是今天post資料到某網頁時,回傳以下資訊。很多,我是新手,一下子就蒙了,這些都是啥喲?哪位大神能解答下。
<html>
<head>
<title>Invalid URI: The URI is empty.</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Invalid URI: The URI is empty.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.UriFormatException: Invalid URI: The URI is empty.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
</td>
</tr>
</table>
<br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[UriFormatException: Invalid URI: The URI is empty.]
System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) +7955503
Core.RequestHelper.get_IsCrossSitePost() +141
Web.ynffc.ajax.Page_Load(Object sender, EventArgs e) +72
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
</font>
</body>
</html>
<!--
[UriFormatException]: Invalid URI: The URI is empty.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Core.RequestHelper.get_IsCrossSitePost()
at Web.ynffc.ajax.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.ynffc_ajax_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8c99ad58\683f3b3a\App_Web_sl0dqnvn.2.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->
uj5u.com熱心網友回復:
附上我的post程式段,很簡單的'------------------通過post獲取指定資訊-----------------------
Public Function postStr(StrUrl$, strref$, stract$) As String
Dim XmlHttp
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "POST", StrUrl, True
XmlHttp.setRequestHeader "Referer", strref
XmlHttp.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
XmlHttp.send (stract)
starttm = Timer
While XmlHttp.ReadyState <> 4
DoEvents
If Timer - starttm > 5 Then postStr = "": Set XmlHttp = Nothing: Exit Function '判斷超出5秒即超時退出程序
Wend
postStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
Set XmlHttp = Nothing
End Function
uj5u.com熱心網友回復:
說不定是服務器程式的問題uj5u.com熱心網友回復:
應該不是,我用httpwatch監控,網頁運行沒問題,但我想post獲取資訊時,它給我回傳這些,郁悶呀uj5u.com熱心網友回復:
問題已經找到了,微軟封鎖了xmlhttp,xmlhttp已經不能設定referer了,所以報錯。我現在改用winhttp就ok了。大家要注意喲。uj5u.com熱心網友回復:
33762439是你的QQ?轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/80919.html
標籤:控件
