Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with IIS 5

Status
Not open for further replies.

cactus1000

Programmer
Aug 31, 2001
149
US
We have a new IIS server (version 5). The new server refuses to execute asp code (which ran fine with version 4), even though the server administrator insists that everything is configured correctly.

I'm sure that there is some setting that needs to be checked.

Has anyone else encountered this problem?
 
Well, we cant get ANY asp code to execute, but here's a sample of what doesn't work.

<%' Defining some constants to make my life easier!
' Begin Constant Definition

' DB Configuration constants
' Fake const so we can use the MapPath to make it relative.
' After this, strictly used as if it were a Const.
Dim DB_CONNECTIONSTRING

' ODBC
'DB_CONNECTIONSTRING = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & Server.Mappath(&quot;indianlaw.mdb&quot;) & &quot;;&quot;

' OLE DB
DB_CONNECTIONSTRING = &quot;dsn=indianlaw;uid=;pwd=;DATABASE=indianlaw.mdb;APP=ASP Script&quot;

'DB_CONNECTIONSTRING = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & Server.Mappath(&quot;indianlaw.mdb&quot;) & &quot;;&quot;
' We don't use these, but we could if we neeeded to.
'Const DB_USERNAME = &quot;username&quot;
'Const DB_PASSWORD = &quot;password&quot;


' ADODB Constants
' You can find these in the adovbs.inc file
' Do a search for it and it should turn up somewhere on the server
' If you can't find it you can download our copy from here:
' ' It may not be the most recent copy so use it at your own risk.
%>
<!--#INCLUDE FILE=&quot;adovbs.inc&quot; -->

<%
' End Constant Definition
%>

<%
Dim I ' Standard looping var
Dim strSQL ' String variable for building our query
Dim iRecordAdded ' Id of added record

'We're going to keep this as simple as we can.
' 1. Create a Recordset object
' 2. Connect the Recordset to the table
' 3. Add a new record to the Recordset
' 4. Set the values of the Recordset
' 5. Update the table
' 6. Close the Recordset

'Step 1:
Dim objRecordset
Set objRecordset = Server.CreateObject(&quot;ADODB.Recordset&quot;)

' The following syntax is also acceptable if you move it outside of the
' script delimiters. I prefer to Dim and then set it like any other
' variable, but it really doesn't make too big a difference.

'<OBJECT RUNAT=server PROGID=ADODB.Recordset ID=objRecordset></OBJECT>

'Step 2:
' The syntax for the open command is
' recordset.Open Source, ActiveConnection, CursorType, LockType, Options
'
' Source
' In this case it's our SQL statement. It could also be a
' Table Name, a command object, or a stored procedure.
' ActiveConnection
' We use a string which contains connection information. It could also
' be a connection object which is faster if you need to open multiple
' recordsets.
' CursorType
' Doesn't matter too much in this case since I'm not going to be doing
' much with the records. I'm opening it as a static so I can get a
' recordcount.
' LockType
' Specifies how the provider should lock the data. We'll use pessimistic
' so that it'll lock as soon as we start editing and basically ensure a
' successful update.
' Options
' Tells what type of source we're using if it's not a command object
'
' Most of the above are optional to some degree. It's usually better
' to set them so you know what their settings are. It'll avoid the
' defaults coming back to haunt you when you try and do something they
' don't allow.

' I'm prebuilding our SQL query so it's easier to print
' out in case we need to debug later. I'm using a query
' that will return no results since I'm really just trying
' to add a new one and am not interested in the current
' data in the table.
strSQL = &quot;SELECT * FROM scratch WHERE 0=1;&quot;

' This is the way I normally would open this RS:
'objRecordset.Open catalog, DB_CONNECTIONSTRING, adOpenKeyset, adLockPessimistic, adCmdText

' You could also do it step by step if you want:
objRecordset.Source = &quot;TABLE1&quot;
objRecordset.ActiveConnection = DB_CONNECTIONSTRING
objRecordset.LockType = adLockPessimistic
objRecordset.CursorType = adOpenKeyset

objRecordset.Open

'Step 3:
' To add a new record to the current recordset we naturally call the
' AddNew Method.
objRecordset.AddNew

' If you're not sure if your RS supports Adding a New record you can check
' via the following command. This will return True if it does, False
' otherwise:
' objRecordset.Supports(adAddNew)

' Another Note: It takes arrays as input and gets confusing so I usually
' don't do it, but you can actually specify the values on the AddNew line
' (combining steps 3 and 4) like this:
' objRecordset.AddNew Array(&quot;text_field&quot;, &quot;integer_field&quot;, &quot;date_time_field&quot;), Array(&quot;Some Text&quot;, CInt(Day(Date())), Now())

'Step 4:
' Here we set the values of each field. You'll notice we don't set the
' id field. Since it's the primary key, I've set it as an autonumber in
' the DB so it'll take care of creating the value for us.

' I'm just pulling any values I want for insertion here. You'd probably use
' something from a form or other user input. Just make sure you're putting
' the right types of data into the fields.

' String / Text Data Type





objRecordset.Fields(&quot;lastname&quot;) = Request.Form(&quot;lastname&quot;)
objRecordset.Fields(&quot;firstname&quot;) = Request.Form(&quot;firstname&quot;)
objRecordset.Fields(&quot;position_tribe_org&quot;) = Request.Form(&quot;position_tribe_org&quot;)
objRecordset.Fields(&quot;address&quot;) = Request.Form(&quot;address&quot;)
objRecordset.Fields(&quot;phone&quot;) = Request.Form(&quot;phone&quot;)
objRecordset.Fields(&quot;fax&quot;) = Request.Form(&quot;fax&quot;)
objRecordset.Fields(&quot;email&quot;) = Request.Form(&quot;email&quot;)
objRecordset.Fields(&quot;description_of_project&quot;) = Request.Form(&quot;description_of_project&quot;)
objRecordset.Fields(&quot;description_of_deliverables&quot;) = Request.Form(&quot;description_of_deliverables&quot;)
objRecordset.Fields(&quot;project_period&quot;) = Request.Form(&quot;project_period&quot;)





'Step 5:
' Couldn't be too much easier:
objRecordset.Update



'Step 6:
' Finally we close the recordset and release the memory used by the
' object variable by setting it to Nothing (a VBScript keyword)
objRecordset.Close
Set objRecordset = Nothing


'********************************
' This is the end of the sample!
'********************************


%>
<CENTER>
<H2>Your information has been received.</H2> </CENTER>
Click <a href=&quot;tribal.html&quot; target=&quot;_top&quot;>HERE</a> to return to the UCLA School of Law Tribal Legal Development Clinic Web Page.
 
I get a &quot;file not found&quot;. This is true of ALL my asp files. I've checked and re-checked the file paths/names until my brain hurts, and everything's correct. It's like the server can't see anything with a .asp file extension.

HTML files open just fine.

This happens whether I use hyperlinks, type in the URL, or try to manually open the files on the server. Nothing.
 
make sure you turn off &quot;friendly http errors&quot; in Internet Explorer Options

have you given script permission to your site in IIS?


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Just some idea:

1. Make sure that if the administrator installed Lockdown tool (from microsoft) and URLScan, he chose &quot;Dynamic Web Page (asp)&quot; option.

2. Double check if he sets &quot;Permission&quot; to &quot;Script&quot; in IIS manager for that site.

3. Temporary turn on &quot;Browse directory&quot; for that site (using IIS manager), then browse that site. See if you can see your asp files. Double click on the file to see if it can run.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top