程序主要代码:
const geturl='http://10.201.13.49/web/Default.aspx';begin
shead:=Tstringstream.Create('');
sresult:=Tstringstream.Create(''); shead.WriteString('__VIEWSTATE=dDwtNjMzMTkyMjIxOzs%2BJMbXZwczJGJYYQlV1hUo%2BuOXmI8%3D&UserID=138&UserPass=111&ButtonSubmit=+');
idhttp1.Request.ContentType:='application/x-www-form-urlencoded';
idhttp1.Post(geturl,shead,sresult);
memo1.Lines.Add(sresult.DataString);
shead.free;
sresult.free;
end.
程序报错,http1.1 500 估计原因是
发现post 的实际地址为'http://10.201.13.49/web/index.aspx' httplook获取信息HTTP/1.1 302 Found
Server: Microsoft-IIS/5.0
Date: Fri, 08 Aug 2008 02:34:52 GMT
X-Powered-By: ASP.NET
Connection: keep-alive
X-AspNet-Version: 1.1.4322
Location: /web/index.aspx
Set-Cookie: ASP.NET_SessionId=32j3r5q02eurlr4515oxwi55; path=/
Cache-Control: private
Content-Type: text/html; charset=gb2312
Content-Length: 132<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href='/web/index.aspx'>here</a>.</h2>
</body></html>造成我post的实际地址是index.aspx 我的猜测是否正确。怎么解决啊。 困扰好几天了。idhttp1.HandleRedirects设置为true了。 那位大哥帮忙说下。小弟一定结贴
const geturl='http://10.201.13.49/web/Default.aspx';begin
shead:=Tstringstream.Create('');
sresult:=Tstringstream.Create(''); shead.WriteString('__VIEWSTATE=dDwtNjMzMTkyMjIxOzs%2BJMbXZwczJGJYYQlV1hUo%2BuOXmI8%3D&UserID=138&UserPass=111&ButtonSubmit=+');
idhttp1.Request.ContentType:='application/x-www-form-urlencoded';
idhttp1.Post(geturl,shead,sresult);
memo1.Lines.Add(sresult.DataString);
shead.free;
sresult.free;
end.
程序报错,http1.1 500 估计原因是
发现post 的实际地址为'http://10.201.13.49/web/index.aspx' httplook获取信息HTTP/1.1 302 Found
Server: Microsoft-IIS/5.0
Date: Fri, 08 Aug 2008 02:34:52 GMT
X-Powered-By: ASP.NET
Connection: keep-alive
X-AspNet-Version: 1.1.4322
Location: /web/index.aspx
Set-Cookie: ASP.NET_SessionId=32j3r5q02eurlr4515oxwi55; path=/
Cache-Control: private
Content-Type: text/html; charset=gb2312
Content-Length: 132<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href='/web/index.aspx'>here</a>.</h2>
</body></html>造成我post的实际地址是index.aspx 我的猜测是否正确。怎么解决啊。 困扰好几天了。idhttp1.HandleRedirects设置为true了。 那位大哥帮忙说下。小弟一定结贴
Server: Microsoft-IIS/5.0
Date: Fri, 08 Aug 2008 03:57:30 GMT
X-Powered-By: ASP.NET
Connection: keep-alive
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/html; charset=gb2312
Content-Length: 5405<html>
<head>
<title>ÎÞ·¨ÑéÖ¤Êý¾Ý¡£</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}
.er {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>¡°/web¡±Ó¦ÓóÌÐòÖеķþÎñÆ÷´íÎó¡£<hr width=100% size=1 color=silver></H1> <h2> <i>ÎÞ·¨ÑéÖ¤Êý¾Ý¡£</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> ˵Ã÷: </b>Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£ <br><br> <b> Òì³£ÏêϸÐÅÏ¢: </b>System.Web.HttpException: ÎÞ·¨ÑéÖ¤Êý¾Ý¡£<br><br> <b>Ô´´íÎó:</b> <br><br> <table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>Ö´Ðе±Ç° Web ÇëÇóÆÚ¼äÉú³ÉÁËδ´¦ÀíµÄÒì³£¡£¿ÉÒÔʹÓÃÏÂÃæµÄÒì³£¶ÑÕ»¸ú×ÙÐÅϢȷ¶¨ÓйØÒì³£ÔÒòºÍ·¢ÉúλÖõÄÐÅÏ¢¡£</code> </td>
</tr>
</table> <br> <b>¶ÑÕ»¸ú×Ù:</b> <br><br> <table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>[HttpException (0x80004005): ÎÞ·¨ÑéÖ¤Êý¾Ý¡£]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +195
System.Web.UI.LosFormatter.Deserialize(String input) +60[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +101[HttpException (0x80004005): Invalid_Viewstate
Client IP: 10.201.120.163
Port: 4025
User-Agent: Mozilla/4.0
ViewState: dDwtNjMzMTkyMjIxOzs+JMbXZwczJGJYYQlV1hUo+uOXmI8=
Http-Referer:
Path: /web/index.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +442
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
</pre></code> </td>
</tr>
</table> <br> <hr width=100% size=1 color=silver> <b>°æ±¾ÐÅÏ¢:</b> Microsoft .NET Framework °æ±¾:1.1.4322.2032; ASP.NET °æ±¾:1.1.4322.2032 </font> </body>
</html>
<!--
[HttpException]: ÎÞ·¨ÑéÖ¤Êý¾Ý¡£
at System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)
at System.Web.UI.LosFormatter.Deserialize(String input)
[HttpException]: Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.
at System.Web.UI.LosFormatter.Deserialize(String input)
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
[HttpException]: Invalid_Viewstate
Client IP: 10.201.120.163
Port: 4025
User-Agent: Mozilla/4.0
ViewState: dDwtNjMzMTkyMjIxOzs+JMbXZwczJGJYYQlV1hUo+uOXmI8=
Http-Referer:
Path: /web/index.aspx.
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadPageViewState()
at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: ·¢ÉúÀàÐÍΪ System.Web.HttpUnhandledException µÄÒì³£¡£
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.Util.AspCompatApplicationStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
[HttpException]: ·¢ÉúÀàÐÍΪ System.Web.HttpException µÄÒì³£¡£
at System.Web.HttpAsyncResult.End()
at System.Web.UI.Page.AspCompatEndProcessRequest(IAsyncResult result)
at ASP.index_aspx.EndProcessRequest(IAsyncResult ar)
at System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
--><!--
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.-->
我看不出有什么问题