Solved

asp not executing

Posted on 2006-07-05
16
327 Views
Last Modified: 2010-04-17
I have a database at that I'm trying to make available on the local intranet at work using
asp. When I browse to the page all I see is the asp code.
I have a 2000 server and the physical location of the file I'm trying to open in internet
explorer is:
C:\inetpub\lhsintranet\default.asp

I have wsus and a sharepoint site on this server both of which are working fine.  
Incidentally the url of the sharepoint site is http://lhs1/default.aspx
I've tried browsing to C:\inetpub\wwwroot\computers\default.asp in internet explorer and
I've also tried browsing to http://lhs1/lhsintranet/default.asp in internet explorer but it
always just brings up the asp code.
I've tried going at this through MS Frontpage and "publishing" the page and nothing works. I realize there's alot I don't understand about all this and would appreciate any help you
can give me.

Here is the code:

<%@ Language=VBScript %>
<%      
           dim adoCon, rsSoftwareLicenses, sqlstr, htmlstr
            set adoCon = Server.CreateObject("ADODB.Connection")
            adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("fpdb/SoftwareLicenses.mdb")        

            set rsSoftwareLicenses = Server.CreateObject("ADODB.Recordset")
             sqlstr = "SELECT * FROM SoftwareLicenses order by LicenseType"
            rsSoftwareLicenses.Open sqlstr, adoCon
            htmlstr = ""
            htmlstr = htmlstr & "<table class='ark'>" & vbCr
            htmlstr = htmlstr & " <tr>" & vbCr
            htmlstr = htmlstr & "  <td class='hed'>LHS Software Licenses</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>LicenseType</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>License Number/Key Code</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>Number Licenses</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>PurchaseDate</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>Supplier</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>InvoiceNumber #</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>UserName</td>" & vbCr
            htmlstr = htmlstr & "  <td class='darkcenter'>Notes</td>" & vbCr
            htmlstr = htmlstr & " </tr>" & vbCr

do while not rsSoftwareLicenses.EOF

            htmlstr = htmlstr & " <tr>" & vbCr
            htmlstr = htmlstr & "  <td><a href='/file.asp?ID=" & rsSoftwareLicenses("ID") & "'>" &           rsSoftwareLicenses("LastName") & "</a></td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("LicenseType") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("LicenseNumber/KeyCode") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("NumberLicenses") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("PurchaseDate") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("Supplier") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("InvoiceNumber") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("Users") & "</td>" & vbCr
            htmlstr = htmlstr & "  <td>" & rsSoftwareLicenses("Notes") & "</td>" & vbCr
            htmlstr = htmlstr & " </tr>" & vbCr

                        rsSoftwareLicenses.MoveNext
            loop
            rsSoftwareLicenses.close
            set rsSoftwareLicenses = nothing
            set adoCon = Nothing
            htmlstr = htmlstr & "</table>" & vbCr

%>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>

<title>LHS Software Licenses</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="lhs.css" />
</head>

<body>

<img border="0" src="fpdb/lhs_logo_red.JPG" width="399" height="180">&nbsp;
<div style="margin-left: 5%; margin-right: 5%;">
<h2>LHS Software Licenses</h2>
<%=htmlstr%>

</div>
</body>
</html>


 

0
Comment
Question by:ksilvoso
  • 7
  • 7
  • 2
16 Comments
 
LVL 1

Author Comment

by:ksilvoso
ID: 17043504
I forgot to say:
In IIS I have created the lhsintranet website, assigned an open port and started the website.
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17043535
is your project directory configured as an application in IIS?
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17043591
>>C:\inetpub\lhsintranet\default.asp
If you open it with a direct path, it will not get picked up by IIS and the ASP code will note get run


>> assigned an open port

If you manually assign a port other than 80, you must specify that port in the URL, e.g.if you use 85 then  http://lhs1:85/lhsintranet/default.asp

Otherwise, are you sure that ASP is installed & functioning within IIS?
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17043624
It's listed as lhsintranet in application pools > sts app pool1
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17043715
JohnBrice,
  When I tried accessing it with http://lhs1/lhsintranet/default.asp it brought up the asp code.
I assigned the port 85 to it (being sure that that port was unused first) and entered it as you suggested but now I get "Page cannot be found"  I tried a different port as well with the same results.  How can I be sure asp is installed and functioning?
Thanks, Karen
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17043831
open IIS, expand Web Sites folder, then expand Default Web Site, navigate to your application folder and see if it was configured as an application

Also check your application path to make sure your application folder is inside C:\Inetpub\wwwroot directory
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17043973
>> http://lhs1/lhsintranet/default.asp it brought up the asp code. I assigned the port 85 ... Page cannot be found

Clearly something is wrong there.  You probably have to stop and restart IISAdmin to get it to recognize port changes.  Is there a reason you want to use something other than 80?

>>How can I be sure asp is installed and functioning?
Put a very simple test file in C:\inetpub\wwwroot\test.asp, such as

<HTML>
<BODY>
This is text<br>
<%Response.write "This is asp<br>"%>
</Body>
</HTML>

and on that machine goto http://localhost/test.asp

You should see both lines.
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17044056
yzlat,
 In iis I have lhsintranet listed under websites and also under default websites. The icon is a gray folder. In the properties of the one under default websites it has default application listed beside application name with create as an option.  I tried creating one called lhsintranet but that didn't help so I deleted it and let it default back to "default application."
I selected scripts and executables in execute permissions.  The home dir for this listing is \lhsintranet and can't be changed.

The same options are selected for the lhsintranet listing directly under websites. The icon for this is a dark green globe.
The home dir of this listing are C:\Inetpub\wwwroot\LHSIntranet (which is correct)
and could be changed with the browse button.
Karen
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 1

Author Comment

by:ksilvoso
ID: 17044093
When I was first setting it up it told me port 80 was used.  I just now changed it to 80 and it let me do it but it still doesn't work.  When I type http://lhs1:80/lhsintranet/default.asp it brings up the asp code and changes the address in the address bar to http://lhs1/lhsintranet/default.asp - it takes out the 80.
0
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 500 total points
ID: 17044135
Yes, the "Default Web Site" uses port 80 by default.  If you are creating a new "web site", you would need to pick a different port number.  Note that there is probably no reason for you to create a new "web site", as a a path within your existing "Default Web Site" is usually adequate.

From your description, I suspect you have created BOTH a new web site and a path within your default web site.  You should remove the new web site "dark green globe" and forget about port number.

Note also that your folder or path in IIS does NOT need to be configured as an application for ASP to run (though there are some reasons you might want it to be).

Try the test file in C:\inetpub\wwwroot
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17044237
JohnBPrice,
   I've deleted all of them and I'm starting over.  When I right click on default website should I choose new website, new website from file, virtual dir, or virtual dir from file?
Thanks
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17044263
If the test file shows you asp code, check in IIS Manager, right click on "Default Web Site", choose Properties, click the "Home Directory" tab, click "Configuration", and the "Mappings" tab.  You must have a line that maps the extension ".asp" to "C:\Windows\system32\inetsrv\asp.dll" with the verbs GET, HEAD, POST, and TRACE.
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17044314
If you put your folder under C:\Inetpub\wwwroot\, you needn't do anything.  Subfolders become part of your Default Web Site automatically.  

Reasons for choosing others are:

Vitrual directory -- Lets you point to a folder that is NOT under C:\inetpub\wwwroot and have IIS treat it as if it were.  For example you might want your web code to really reside on D:\whatever.  You can make a virtual directory so IIS translates  http://localhost/MyNewFolder to D:\Whatever instead of looking for C:\inetpub\wwwroot\MyNewFolder.

New Web Site:  When you run several web sites off one computer, for example shared hosting services do this so every customer can have their "own" web site.
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17044329
>>I've deleted all of them and I'm starting over.
Not including "Default Web Site" I presume.

>>When I right click on default website should I choose new website, new website from file, virtual dir, or virtual dir from file?

Actually, just put that test file up first to make things work before you spend a lot of time on it.


0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17045730
Success at last!!  I wound up creating a separate web again after all and assigning port 85 even though it is located inside wwwroot. Then I made it a virtual dir and now the page opens with this url:
The only thing that differs with your instructions, JohnBPrice, is the location of the folder.  I guess I could have put it elsewhere since I'm using the separate port and everything but it works.

http://localhost:85/SoftwareLicenses.asp

Thanks a million for all your help.  I learned alot today.
Karen
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17046151
>>even though it is located inside wwwroot.

As long as you don't care about security, that's fine (it is now technically in both URLs http://lhs1:85 and http://lhs1/lhsintranet ).  Also, from your description, something is still messed up on "Default Web Site" as you should never see asp code in your browser.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now