Cannot find server or DNS Error, page cannot be displayed when uploading files? Article

Member of  ScriptUtils | Changes | Purchase | Download

Cannot find server or DNS Error, page cannot be displayed when uploading files?

Some common answers to handle upload data with size over allowed limit. Possible solutions, problematic situations, communication between client browser (IE and similar) and IIS server.

      Q1:  I have not altered the sample code, but when upload a file larger than limit, I do not get error message -just page not found.
      Q2:  I have been evaluating your software for use at my company. I have not had luck limiting file size. As I am evaluating several products I have not had time to really trouble shoot problems. Maybe you can help me out. Everytime I limit the file size I get: Cannot find server or DNS Error Any ideas why this is happening? I am using your form-Sizelimit.asp sample from your web page. The simpleupload works flawlessly.

     Introduction

     The problem is mainly a problem with client browsers - there is no standard for http clients to handle situation when server does not accept the POST request. HTTP/1.1 specifies '413 Request Entity Too Large' status code as a server response for such situation. This message means: The server is refusing to process a request because the request entity is larger than the server is willing or able to process. The server MAY close the connection to prevent the client from continuing the request. 

     Each client has a special 'method' to handle such situation. And IE uses several random messages: 'The page cannot be displayed' the 'Cannot find server or DNS Error' and similar, latest versions of Mozilla shows dialog with 'document contains no data' message, or you can be also redirected to http://localhost.be/ :-).

You can see more about this problem on internet (google) at
http://groups.google.com/groups?q=upload%20error%20404&hl=cs&lr=&ie=UTF-8&sa=N&tab=wg
http://www.google.com/search?hl=cs&ie=UTF-8&q=Request+Entity+Too+Large+page+not+found&lr=
etc.

    Some solutions to handle upload data limit.

    There is no ideal way to solve such situation (source data over allowed limit) and there are two half-ideal:

1. Ignore the POST data when the data size is over the limit.
This solution is ideal for server-side security, performance and time of a response. The base idea for the code (ASP) looks like:
If Request.TotalBytes>0 Then
  Response.Status = "413 Request Entity Too Large"
  Response.Write "Some good message explaining that the client sends too large file"
Else
  'process form data
End If
or similar for ASPForm:

If Form.State = 0 Then 'completed
  'something to do with data
  Form.Files.Save "c:\upload"  
ElseIf Form.State = fsSizeLimit  Then
  Response.Status = "413 Request Entity Too Large"
  Response.Write "Some good message explaining that the client sends too large file"
End If'Form.State = 0 then

(Remember that UploadReadAheadSize property of IIS metabase must be set to zero to get work this code properly, see Upload - Monitor and handle upload state/result)

This code has some great features:


  The problem is (as I wrote) that most of the clients (IE, NN, opera ...) does not accept such behavior correctly. Client will receive the answer quickly, but the a client browser shows the server answer funny.

2. Read all the source data.
Client browsers accepts only one response: 100 continue. Or, as IE - the browser ignores initial server response - sends the form data regardless of the response. So if you read all source data, you can tell the client, that the data are over allowed limit ...
This is great for users, because there are no problems with 'bad' error messages. But the server can be down with one or more 'dirty' clients which simply sends gigabytes of POST data to the script over equally strong internet line. The base programming idea is:
If Request.TotalBytes>0 Then
  Request.BinaryRead(Request.TotalBytes)  
  Response.Status = "413 Request Entity Too Large"
  Response.Write "Some good message explaining that the client sends too large file"
Else
  'process form data
End If
(The command 'Request.BinaryRead(Request.TotalBytes)' is not good idea, of course, it will place all request data in the memory. You must read the data block-by-block)

The default method in all sample scripts of Huge (Pure) ASP file upload is the first method - the POST data are ignored and '413 Request Entity Too Large' is send by the scripts. You can use second method, if you want to exactly show an error message for clients with form data over limit.
You can also use some combination of this methods - for example:
- set SizeLimit to 10MB and handle files with up to 10MB size
- if source data size is over the limit, but <20MB, you can read all the source data, do nothing with them and show error message to clients (something small over the limit)
- if source data size is over 20MB, ignore the request to save server resources.

See also:  UploadReadAheadSize

Other links for Cannot find server or DNS Error, page cannot be displayed when uploading files? article

ScriptUtils.FAQ for Huge ASP file upload and scriptUtilities

Frequently asked questions about ScriptUtilities, Pure-ASP and Huge-ASP upload functionality.

ScriptUtils

Huge ASP upload is easy to use, hi-performance ASP file upload component with progress bar indicator. This component lets you upload multiple files with size up to 4GB to a disk or a database along with another form fields. Huge ASP file upload is a most featured upload component on a market with competitive price and a great performance . The software has also a free version of asp upload with progress, called Pure asp upload , written in plain VBS, without components (so you do not need to install anything on server). This installation package contains also ScriptUtilities library. Script Utilities lets you create hi-performance log files , works with binary data , you can download multiple files with zip/arj compression, work with INI files and much more with the ASP utility.

© 1996 - 2011 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz


Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object