Tips for Classic ASP developers on IIS7

Posted: May 21, 2007  49 comments

Average Rating

Tags
Administration
ASP
IIS News Item
IIS7
Troubleshooting

I was reminded the other day just how many classic ASP applications and developers there are out there!  The original ASP rocks, I remember experiencing it for the first time back in 1996/97 when it first came out with IIS3, and being amazed at how programmable it was compared to ColdFusion.  I built many an application using Classic ASP, and there will always be a soft spot in my heart for it. :)

There are a few changes in IIS7 which Classic ASP developers should be aware of.

 

ASP not installed by default

First things first!  If you're moving from XP to Windows Vista / Longhorn Server, you may be getting this error:

--------------------------------------------------------------------------------------------------------------------

HTTP Error 404.3 - Not Found

Description: The page you are requesting cannot be served because of the Multipurpose Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.

--------------------------------------------------------------------------------------------------------------------

this is usually the case when you haven't installed the ASP component.  Go to where you installed IIS and look under IIS/WWW Services/Application Development/ASP and install it.  :)

 

Access and Classic ASP

A lot of people use Access as a database - because it is small, can be copied around, and is easy to manage.  One of the changes we made in IIS7 in Vista broke using ASP and Access by default.  I described this change in more detail in this post, but essentially it has to do with the fact that Application Pools now use the Application Pool identity's profile and temporary directory, rather than \windows\temp by default.  And since the only one that can write to Network Service's temp directory is the Network Service, anonymous or authenticated ASP applications break, since ASP uses the impersonated identity to access the database.  If you use ASP and Access on IIS7, you've probably seen this error, or a variation of it: 

--------------------------------------------------------------------------------------------------------------------

Microsoft JET Database Engine error '80004005'
Unspecified error

--------------------------------------------------------------------------------------------------------------------

The answer is pretty straight forward:  turn off loadUserProfile, or ACL the temp directory to allow writes.  As a result of this and other compatibility issues, we're considering reverting this change in Longhorn Server / Vista SP1.  In the mean time, you can work around it by doing either of the following:

This appcmd command will turn off loadUserProfile for the Default Application Pool.  if your application runs in a different AppPool, make the corresponding change:

%windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false

This command will ACL the Network Service temp directory to allow creator write / read privledges.  If you run your Application Pool under a different identity, you'll need to ACL that owner's temp directory:

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant Users:(CI)(S,WD,AD,X)

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant "CREATOR OWNER":(OI)(CI)(IO)(F)

 

Script errors no longer shown in browser by default

As a result of our security paranoia, we turned off ASP's default behavior of sending script errors (including line number and code snippet to the browser.  So instead of seeing the typical error you would see ASP throw, you will now see this:

--------------------------------------------------------------------------------------------------------------------

An error occurred on the server when processing the URL. Please contact the system administrator

--------------------------------------------------------------------------------------------------------------------

To revert back to IIS6- behavior, simply run the following command:

%windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true

Or you can find it in the UI here:

asp-scripterrors

then you'll be back to seeing this style of error instead:

--------------------------------------------------------------------------------------------------------------------

Microsoft VBScript compilation error '800a03ea'

Syntax error

/test.asp, line 4

Response.Write("I love classic ASP" && foo)
-------------------------------------^

--------------------------------------------------------------------------------------------------------------------

 

Parents paths disabled by default (redux)

We disabled parent paths by default with IIS6, but I've seen this hit people on Vista coming from XP, where it is still enabled by default in IIS5.1  The enableParentPaths setting determines where ASP "includes" should be allowed to escape the parent directory (eg. ../../../includeFile.inc).   You'll see this error by default if you try to escape the current directory:

--------------------------------------------------------------------------------------------------------------------

Active Server Pages error 'ASP 0131'

Disallowed Parent Path

/test.asp, line 1

The Include file '../bad.inc' cannot contain '..' to indicate the parent directory.

--------------------------------------------------------------------------------------------------------------------

or you may see this error if you are using a path with ../ in it and your ADODB code

--------------------------------------------------------------------------------------------------------------------

Server.MapPath() error 'ASP 0175 : 80004005'

Disallowed Path Characters

/testdir/test.asp, line 9

The '..' characters are not allowed in the Path parameter for the MapPath method.

--------------------------------------------------------------------------------------------------------------------

To revert back to IIS 5.x behavior, simply run the following command:

%windir%\system32\inetsrv\appcmd set config -section:asp -enableParentPaths:true

or you can find the UI setting here:

asp-enableparentpaths

 

APPL_PHYSICAL_PATH no longer returns "\" with path

If you use Request.ServerVariables("APPL_PHYSICAL_PATH") to get at the physical path for your application, you may notice that the physical path no longer returns with a trailing slash.  In previous releases of IIS, we returned this value as stored in the metabase.  In IIS7, we calculate this value based on the configuration store, and we never return a trailing slash.  You'll need to account for this especially if you are the return value with some other part of the path in your application.

  

Summary

I browsed through the IIS7 Classic ASP Forums, and these tips seemed to cover nearly all of the issues people were having.  if you are having a problem with ASP on IIS7, check out the forums or leave a comment for me here.  If I find the answer, I'll add it to this post!  Thanks!

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

Comments

  1. Rob
    May 22, 2007
    Bill, brilliant - thank you for this!
  2. TrackBack
    May 22, 2007
  3. TrackBack
    May 22, 2007
  4. TrackBack
    May 22, 2007
  5. Frank Lopes
    May 22, 2007

    When I tried

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false

    I got an error:

    ERROR ( hresult:80070005, message:Command execution failed. Access is denied. )

    What am I doing wrong?

  6. bills
    May 22, 2007

    Hi Frank.  make sure you run all of the commands above in an 'elevated' command prompt.  To do this, click your "start" button, type in 'cmd', then right click on the command prompt icon and choose 'run as administrator'.  Only administrators can change IIS configuration, so you must elevate to administrator in order to run the commands.  

  7. Johanb
    May 23, 2007
    Thanks for your info. I've managed to get everything up and running with Vista/IIS7/Classic ASP/ASP.NET1.1 (after MUCH struggling, coming from XP). I've also managed to install SQL Server 2000 although it's not a supported configuration from Microsoft. I have an old web application with a mix of ASP/ASP.NET and it's working BUT for one thing. I get this message on some of my pages: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified /includes/opendb.asp, line 12 I use a DSN-less connection string. The SQL Server is running SP4 and is running in Mixed-mode. My main issue here, I think, is that IIS 7 has a new line-up of user accounts, (IUSR?), ASPNET and the groups IIS_IUSRS and IIS_WPG. This confuses me (and my SQL server) a bit. Could you elaborate a little bit on how to configure the IIS accounts regarding SQLserver or maybe give me some pointers to other web resources which might cover it?
  8. bills
    May 24, 2007

    Hi Johanb - could you email me some ASP code that reproduces the issue, and we'll take a look.  It is hard to say what may cause this issue, without seeing the underlying code, but it doesn't look like a permissions issue off-hand.  Seeing a repro of the issue would help us narrow it down.  

  9. jbwillers
    May 28, 2007
    Hi there Bill, Thanks for the advice above, it did come in very handy during each stuble block of getting IIS 7 to run with my ASP sites. Ok I have migrated my XP & IIS5 ASP sites over to my new Vista machine and ran into a wall. I've got IIS running, installed ASP, made other changes as mentioned above BUT now got stuck with this error and can't seem to find any solutions out there: Microsoft JET Database Engine error '80004005' 'C:\inetpub\wwwroot\mmcdb\mmc.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. /mmc/Default.asp, line 15 As you can see IIS misses a '\' (supposed to be 'C:\inetpub\wwwroot\mmc\db\mmc.mdb') when generating the ASP to link to my Database, so no wonder it can't find it! I'm sure it's something small or stupid I'm doing wrong but as I said this worked fine on old machine.
  10. bills
    May 28, 2007

    Hi jbwillers - glad the post helped.  That is a strange issue.  Could you post or email me the code which generates the path, so I can try to reproduce the issue?  

  11. jbwillers
    May 29, 2007
    Thank for the quick reply: For clarification the Database is 'bosbokDb.mdb' which resides in a folder 'bosbokDb'. Most importantly this code works 100% in XP, so I don't think it's the code. If you want to I can give you the FTP details to the site, you can download the whole lot. - But I'm sure you DO have a life... ;-) The first 20 lines or so of Default.asp reads as follows: =========== <> "") Then rsSiteDetails__MMColParam = Request("MM_EmptyValue") End If %> =========== As I said I think it's a mis-interpretation by VISTA/IIS/Whatever of my Connection string, which reads: =========== =========== Thanks for the help. JB
  12. bills
    May 29, 2007

    Hi jb - it looks like you may have found a bug, we're looking into it.  In the mean time, you can fix this bug in your code pretty easily.  The last line is key.  Change it from:

    ="& request.servervariables("APPL_PHYSICAL_PATH") & "bosbokDb/bosbokDb.mdb"

    to:

    ="& request.servervariables("APPL_PHYSICAL_PATH") & "\" & "bosbokDb/bosbokDb.mdb"

    that should do it.  I'll let you know what we find.

  13. jbwillers
    May 29, 2007
    Heaven's are opening, whites doves are flying around, skimpy clad girls are frolicking in the fields...much appreciated!
  14. Derek
    May 30, 2007

    I'm working on a classic .asp project and can't seem to connect to the  database using

    <%

    Connect_String="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("CFMH_PARTNERING.mdb")&";Persist Security Info=False"

    %>

    I'm getting this error: Microsoft JET Database Engine error '80004005'

    Unspecified error

    I'm trying to disable user profiles using your script:

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false

    However I'm getting an error message that states:

    ERROR <message:Unkown config section "applicationPools/[name='DefaultAppPool'].processModel.loadUserProfile:false".

    I don't have any experience working with ISS, so any help would be appreciated

  15. bills
    May 30, 2007

    Hi Derek -

    Looks like you may have accidently dropped the space between the section and property parameters.  Try the command again and make sure there is a space between applicationPools<space>/[name... so the entire command is like this:

    %windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false

  16. Bahadir ARSLAN
    May 30, 2007
    Hi, Firstly thanks for your helps. But i tried everything that you suggest, but still same error. "Unspesified Error" Am i the one, who couldn't solve this problem?
  17. bills
    May 30, 2007

    Bahadir: are you using ASP and Access?  Are you seeing Microsoft JET Database Engine error '80004005' or something else?

  18. SUR
    May 31, 2007
    If your classic asp website wont connect to your sql express 2005 database then i would suggest changing the authentication mode to mixed mode as described here: http://cfpayne.wordpress.com/2006/07/21/changing-authentication-in-sql-server-2005-express/
  19. Zahra
    May 31, 2007
    I am moving my website from IIS 6 to IIS 7.0. It is written using ASP Classic and uses a DLL written in Foxpro 8.0. I tried suggestion from a lot of blogs but it doesn't seem to work. After enable scripterrortobrowser i get this error message: Server object error 'ASP 0177 : 80020009' Server.CreateObject Failed /Default.asp, line 2 80020009
  20. bills
    May 31, 2007

    Hi Zahra - what does line 2 look like?  What is the object you are trying to create with Server.CreateObject?

  21. Zahra
    June 1, 2007
    Bill, default.asp line 2: SET ox = server.CREATEOBJECT("webstd7.test") my entire code is in a DLL written in Visual Fox pro 6.0. Server.createobjects creates an instance of DLL. I am only using two asp pages default.asp and action.asp.
  22. bills
    June 1, 2007

    Hi Zahra - error 80020009 typically means a recordset error of some kind?  I assume foxpro has been installed and the object has been properly registered on the box?  if you could email me a bit of code and the COM object you are using which reproduces the issue, I can have someone here take a look at it.  Or you could try calling our support team: blogs.iis.net/.../where-do-i-go-for-iis-support.aspx they really rock!

  23. Pam Newberry
    June 7, 2007
    I'm just trying to get a web site other than the default web site to work. I read somewhere to use port 81 so I set it up with port 81 and am trying to access it using the following http://localhost:81/testsite1.com/ I get http error 404.0 Not found error. Under the inetput/wwwroot/ directory I have the testsite1.com subdirectory which contains an index.asp file. Any suggestions or a URL for help would be most appreciated. Thanks
  24. bills
    June 7, 2007

    Hi Pam.  If you have set up the site on port 81, you’ll need to connect to this address:  http://localhost:81/testsite1.com/">localhost/testsite1.com

    Probably a better way to do this is to move testsite1.com directory to the \inetpub directory.  I would also rename it to just “testsite1” – windows doesn’t like directories with .com at the end.  Then I would create a new site on port 81 and point it to \inetpub\testsite1.  Then you can access it by going to http://localhost:81/  

    Last, if you want to access it with a different name, edit your \windows\system32\drivers\etc\hosts file and register a new host header, then set the site up with a host header instead of a different port.  You can have unlimited host header sites on vista.

    hope this helps -

  25. pjnewberry
    June 9, 2007

    Hi Bills..thanks for your help. So let me back up now and try to do this the correct and easiest way. Let's say I want to have 3 web sites that I want to work with. In IIS5.1 (XP pro) I just changed one by one the home directory under IIS to point to the directory I wanted under inetpub/wwwroot. But now with iis7.0 are you saying I would just need to add entries to my hosts file to look at the 3 sites. Then what would be the URL to get them. I don't want to have to move my files to the inetput/wwwroot directory to get them to work. I want to just have subdirectories under that..one for each site. Are you saying all I need is an entry in the hosts table, one for each site. What would the IP be? And what address would I use to access them? Feel free to direct me to someplace that has this info. Again..thanks for the help. Pam

  26. pjnewberry
    June 9, 2007
    Bills..No need to respond to my last question. I was finally able to wrap all the pieces together and get things to work. To change from one web site to another will require a change each time but until I figure a way to do it without making that change this works. 1. In IIS manager select default web site under Web sites. Right click and select Advanced Settings. Under physical path, change the directory to the desired location of the site files. If needed, a change may be made to the default document on the main page of the IIS manager. 2. If you receive the ""An error occurred on the server when processing the URL. Please contact the system administrator" the problem is probably minor. To get a more detailed error message, open IIS Manager. Right click on default web site and look at the last entry. It should be Switch to content View. If it does not say that, click the switch to ... and get the features view. Select the ASP icon under the IIS section. Under compilation select the + sign by Debuggin Properties and set Send Error To Browser to TRUE. You will now have a message that will help you fix the problems. There it is..one way to get multiple sites to work. If you have another way, I'd like to hear about it.
  27. Ralph
    June 10, 2007
    In your comment: this is usually the case when you haven't installed the ASP component. Go to where you installed IIS and look under IIS/WWW Services/Application Development/ASP and install it. :) I am having trouble understanding this. I am using vista of course. Did you mean that this is under the Turn windows features on and off section of the control panel? Ralph
  28. bills
    June 11, 2007

    Hi Ralph - see this article on how to install IIS on Vista:  www.iis.net/.../Install-IIS7-on-Vista

  29. Coder32
    June 13, 2007

    Hi. I love you man. Thanks thanks thanks............ Best Regards

  30. NiEL
    June 13, 2007
    Hi. Hope you can help me, I'm a newbie to ASP. My code works previously in XP but not in Vista. I get this error: Server.MapPath() error 'ASP 0175 : 80004005' Disallowed Path Characters /bullet/account/connection.inc, line 4 The '..' characters are not allowed in the Path parameter for the MapPath method.
  31. bills
    June 14, 2007

    Hi Niel.  Can you also show or send what you have in connection.inc line 4?

  32. Pichopper
    June 15, 2007
    Hi there! I am wanting to know if IIS7.0 under Vista will allow me to host more than one website on the same machine. I have a machine that I want to host at home with my personal website on it, and another with a photogallery - I don't want the two to be on the same domain name. Please would you let me know what I would need to do? I know that this can be done in Server 2003, but I also want to use the machine to play my music at home! (Multitasking to the limit!) Thanks
  33. bills
    June 15, 2007

    Hi Pichopper -

    Yes! IIS7 will allow you to host more than one Web site at a time.  See this post: blogs.iis.net/.../How-I-fell-in-love-with-Vista-this-weekend-_2800_or-why-you_2700_re-gonna-love-IIS7_2F00_Vista-for-Web-development_2900_.aspx for more info on other features you may be interested in.

  34. bills
    June 17, 2007

    Niel - thanks for sending me the code from your script.  This error:

    Server.MapPath() error 'ASP 0175 : 80004005' Disallowed Path Characters /bullet/account/connection.inc, line 4 The '..' characters are not allowed in the Path parameter for the MapPath method.

    is caused by the "Parents paths disabled by default" section I describe above.  I've updated my blog to reflect this error as another symptom.  Try enabling parent paths.

  35. Alex Thissen Weblog Build 1.15.10.1971
    February 18, 2008

    It's not really difficult to run classic ASP on Internet Information Server 7, but there are some bumps

  36. Peter Bucher
    April 2, 2008

    Andere sind über diesen Link sich genau so froh wie ich, als ich ihn gefunden habe :-) Darin werden Probleme

  37. Vista, IIS7 and classic ASP/Access « snuke
    April 17, 2008

    Pingback from  Vista, IIS7 and classic ASP/Access &laquo; snuke

  38. Vista, IIS7 and Classic ASP/Access « snuke
    May 14, 2008

    Pingback from  Vista, IIS7 and Classic ASP/Access &laquo; snuke

  39. Vista, IIS7 and Classic ASP/Access « snuke
    May 14, 2008

    Pingback from  Vista, IIS7 and Classic ASP/Access &laquo; snuke

  40. ??pu??lar??m » Blog Archive » IIS Access Db sorunu
    June 1, 2008

    Pingback from  ??pu??lar??m  &raquo; Blog Archive   &raquo; IIS Access Db sorunu

  41. What I Learned Today: Programming, Research, Life
    June 11, 2008

    As I get used to my new laptop with Vista (not as bad as everyone has indicated ...), I found the following page extremely helpful in setting up a local instance of IIS 7 on the laptop for devel ...

  42. Jonas Stawski
    June 20, 2008

    Classic ASP on Vista

  43. Jonas Stawski
    June 20, 2008

    Classic ASP on Vista

  44. Jonas Stawski
    June 20, 2008

    Classic ASP on Vista

  45. Jonas Stawski
    June 20, 2008

    Classic ASP on Vista

  46. Hanif’s Blog » Blog Archive » Common ASP Classic Error in IIS 7.0
    June 24, 2008

    Pingback from  Hanif&#8217;s Blog  &raquo; Blog Archive   &raquo; Common ASP Classic Error in IIS 7.0

  47. MHanif.Com - Blog » Blog Archive
    August 15, 2008

    Pingback from  MHanif.Com - Blog  &raquo; Blog Archive

  48. NACSE
    August 27, 2008

    A new view on Windows Vista - A developers perspective

  49. NACSE
    September 1, 2008

    A new view on Windows Vista - A developers perspective

Page view counter