IIS7: Security is Painful for Classic ASP
IIS7: Security is Painful for Classic ASP
An error occurred on the server when processing the URL. Please contact the system administrator
I just got a Vista Machine for 30 days in Office, has my new machine may take some time to come and and i wrote some code in good old classic ASP code today. On IIS7 I only got the following though:
An error occurred on the server when processing the URL. Please contact the system administrator
After investigating a bit I figured out that we changed the default for the “scriptErrorSentToBrowser” flag in IIS7. It’s now false and you always get the error above. Here is how to change it:
1) Start an elevated command prompt. Right-click the command shell item in the Start-Accessories menu and select “CMD and run as Administrator”.
2) Run the following command: %windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true
On Live production Enviroment Once you are done with debugging your ASP app please set it back to false. There are lots of ‘evildoers’ out there!
Time Base Flagging with ASP datetime function
Time Base Flagging with ASP datetime function
<%
strStartTime1 = "13/02/2012 05:10:00"
strEndTime1 = "16/02/2012 05:11:00"
strDiff1 = DateDiff("n",strStartTime1,strEndTime1)
'response.write strDiff1
'response.write "<hr>"
if strDiff1 >=0 then
%>
<center> <h3>"ORDERS PLACED NOW FOR VALENTINE'S DAY - 14TH FEBRUARY WILL BE DELIVERED LATEST BY 15TH FEBRUARY"</h3> </center>
<%
else
end if
%>
Dynamic Arrays
Dynamic arrays come in handy when you aren’t sure how many items your array will hold. To create a dynamic array you should use the Dim statement along with the array’s name, without specifying upper bound:
<% Dim arrCars arrCars = Array() %>
In order to use this array you need to use the ReDim statement to define the array’s upper bound:
<% Dim arrCars arrCars = Array() Redim arrCars(27) %>
If in future you need to resize this array you should use the Redim statement again. Be very careful with the ReDim statement. When you use the ReDim statement you lose all elements of the array. Using the keyword PRESERVE in conjunction with the ReDim statement will keep the array we already have and increase the size:
<% Dim arrCars arrCars = Array() Redim arrCars(27) Redim PRESERVE arrCars(52) %>
Static Arrays
<%@ LANGUAGE="VBSCRIPT" %> <% 'Use the Dim statement along with the array name 'to create a static VBScript array 'The number in parentheses defines the array’s upper bound Dim arrCars(4) arrCars(0)="BMW" arrCars(1)="Mercedes" arrCars(2)="Audi" arrCars(3)="Bentley" arrCars(4)="Mini" 'create a loop moving through the array 'and print out the values For i=0 to 4 response.write arrCars(i) & "<br>" Next 'move on to the next value of i %>
Here is another way to define the array in VBScript:
<%
'we use the VBScript Array function along with a Dim statement
'to create and populate our array
Dim arrCars
arrCars = Array("BMW","Mercedes","Audi","Bentley","Mini") 'each element must be separated by a comma
'again we could loop through the array and print out the values
For i=0 to 4
response.write arrCars(i) & "<br>"
Next
%>
Selected Characters from VBA’s Character Code Set
|
XP / IIS Max Connections
IIS on XP Professional is limited to 10 connections at LocalHost on web server, But now we can change that "restriction" using a tool provided by the "Vendor". Download MetaEdit Navigate to the key LM/W3WSVC/MaxConnections Double click to edit and change to something else. Note: Max connections on IIS running on Win2k Server is: 2000000000
(Contains 1 attachments.)
