Microsoft KB Archive/254786

= PRB: Query String Truncated =

Article ID: 254786

Article Last Modified on 6/24/2005

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Explorer (Programming) 5_beta

-



This article was previously published under Q254786



SYMPTOMS
When you send a long query string from a WinInet application to a Web server, the query string may be truncated.



CAUSE
This issue occurs because of the length limitation of the URL in WinInet, which is defined in the Wininet.h file as follows:

This behavior is by design.
 * 1) define INTERNET_MAX_PATH_LENGTH       2048
 * 2) define INTERNET_MAX_SCHEME_LENGTH     32          // longest protocol name length
 * 3) define INTERNET_MAX_URL_LENGTH        (INTERNET_MAX_SCHEME_LENGTH + sizeof("://") + INTERNET_MAX_PATH_LENGTH)

Note: Because Internet Explorer and Internet Transfer Control also use WinInet, the same issue may occur.



RESOLUTION
To resolve this issue, use the HTTP POST method. For example:

Using Internet Transfer Control on the client side: Private Sub Command1_Click Dim strData As String strData = "QName=longquerystring+longquerystring+longquerystring+longquerystring" Inet1.Execute "http://myserver/scripts/post.asp", "POST", strData, "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Connection: Keep-Alive" End Sub Using ASP on the server side:  <% cName = Request("QName") %>  Hello, the data you posted is: <% =CName %>.   or   Hello, the data you posted is: <% Response.Write(Request.Form("QName")) %>.  



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

For additional information on how to properly simulate a Form POST in WinInet, click the article number below to view the article in the Microsoft Knowledge Base:

165298 HOWTO: Simulate a Form POST Request Using WinInet

