Category Archives: ASP

“HTTP Error 404 – File or Directory not found” error message when you request dynamic content with IIS 6.0

I ran across this problem with an ASP page and found a solution on the Microsoft Support site.

Symptoms:
Active Server Pages (ASP) page, ASP.NET page, Internet Services API (ISAPI) application, or Common Gateway Interface (CGI) application on a Windows Server 2003 server running Internet Information Services (IIS) 6.0, give the following error messages:

  1. HTTP Error 404 – File Not Found
  2. HTTP Error 404 – File or Directory not found

Cause:
IIS 6.0 was set to serve only static HTML pages by default on Windows Server 2003

Solution:
Using the IIS manager Allow Active Server Pages under the Web service extensions node.

String Functions (Len, Left, Right, Mid)

<%
dim myvar
myvar = "1234567"

response.Write(myvar & " is the variable<br/>")
response.Write(len(myvar) & " characters long<br/>")
response.Write(left(myvar,3) & " are the <b>left</b> three characters<br/>")
response.Write(right(myvar,3) & " are the <b>right</b> three characters<br/>")
response.Write(mid(myvar,3,3) & " : Mid(MyString, StartPos, NumChars)<br/> %>

Output:

1234567 is the variable
7 characters long
123 are the left three characters
567 are the right three characters
345 : Mid(MyString, StartPos, NumChars)

ASP: Find the length of a string using len and lenB function

my_string="Welcome to MySite.com"
Response.Write ( my_string )
Response.Write "Length of this string = " & len(my_string)
Response.Write "Number of bytes Required for this string = " & lenB(my_string)

The output of this will also show the number of bytes required. Here in this case it will print this:

Welcome to MySite.com
Length of this string = 21
Number of bytes Required for this string = 42