Link to home
Start Free TrialLog in
Avatar of michaelshavel
michaelshavel

asked on

How to link up ASP pages with backend SQL Server 2005

Hi,
I've recently taken over administration of a web site running on Server2003. I'm in the process of moving the site over to a new server (also Server2003). The new server I'm moving it to has IIS 6, the old server, I believe has IIS 5, though I can't be sure because going under Help->About IIS doesn't tell me a version number. What makes me think it's IIS5 is when I view properties for one of the ASP files, the box that comes up doesn't have an ASP.NET tab.   In any case, the reason I said all this about versions of IIS is because of my question.
I need to connect these ASP pages to my backend database (SQL Server 2005), [The basic HTML pages are already up and running on the new server]  I've already moved over the database from the old server (it was running on SQL2000. The data move was smooth, I used backup/restore).
On my new server it looks like the connection string for each ASP file resides in the Properties->ASP:Net->Edit Config Tab.
However, looking on the old server, I can't see where the connection string was, because as I said, there was no Properties->ASP:NET->Edit Config  Tab.
So the  basic question is, how to I link up ASP pages to my backend database on the new server.
Sorry if this was a bit wordy, but I wasn't sure which piece of information you might need.

Let me know if you need to know anything else.

Thanks

Mike
PS. I've done this  a hundred times using  MySQL/Perl/DBI, so 'speaking in tech' to me is fine. I just don't know Microsoft technologies all that well.
Avatar of samtran0331
samtran0331
Flag of United States of America image

The ASP.Net tab in IIS is just writing to the web.config file of your app.
So you can check the connectionstring by just opening the web.config file in any text editor.

However, if you don't see the ASP.Net tab in IIS, that means ASP.Net is not properly installed on the new server.
Chances are the .Net framework is installed, just the ASP.Net part needs to be setup.
You do the setup from the command line using the
"aspnet_regiis.exe" tool...it's version specific...so if your app is ASP.Net 2.0, open up a command prompt, browse to the framework folder...something like:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
then from the prompt, run:
aspnet_regiis.exe -i

http://msdn2.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx
Avatar of michaelshavel
michaelshavel

ASKER

Hi,
I do see the ASP.Net tab on the new server, just not on the old one. I don't need to install it on the old one as I'm migrating away from it. Thanks for the info though.

Regarding the web.config file. Where would I find this? Are there more then one? When you say it's writing to the web.config file of my app, do you mean that every .asp file is an app so that I would have multiple web.config files or does each site on my server have only one web.config file?   I need a little more basic understanding of the concept.


Here's another piece of my puzzle.  This site has many files (HTML and .ASP).  I've put all of these files up on a test domain on the new server. If I point my browser to one of the HTML files, it displays properly.  However, if I point it to one of the .ASP files, it says 'The page cannot be found'. I know for a fact that the page does exist in the URL path on the server though. Is this message coming up because the ASP page isn't in some way linked to the database or is there something else I have to do to make .ASP pages visible. (Example -- if it was a PERL/UNIX issue I would just have to make sure the permissions on the Perl script were to execute. Is there something similar that needs to be done for .ASP files?)

Thanks again,
Mike
>>I do see the ASP.Net tab on the new server, just not on the old one. I don't need to install it on
>>the old one as I'm migrating away from it. Thanks for the info though.

Sorry, I mis-read your question, but the aspnet_regiis tool will be very good friend if you need to work with ASP.Net and IIS.


>>Regarding the web.config file. Where would I find this? Are there more then one? When you say
>>it's writing to the web.config file of my app, do you mean that every .asp file is an app so that I
>>would have multiple web.config files or does each site on my server have only one web.config
>>file?   I need a little more basic understanding of the concept.

Just for clarity, ASP.Net pages have the extension "*.aspx" (Classic ASP files end in *.asp)
Usually, with ASP.Net, every virtual directory is an app.
And normally, an app has one web.config file; although it can have more than one.
When you use the ASP.Net tab in IIS, it is reading the default web.config file which should be in the root folder of the app.


>>Here's another piece of my puzzle.  This site has many files (HTML and .ASP).  I've put all of
>>these files up on a test domain on the new server. If I point my browser to one of the HTML
>>files, it displays properly.  However, if I point it to one of the .ASP files, it says 'The page cannot
>>be found'. I know for a fact that the page does exist in the URL path on the server though.
>>Is this message coming up because the ASP page isn't in some way linked to the database or is
>>there something else I have to do to make .ASP pages visible. (Example -- if it was a PERL/UNIX >>issue I would just have to make sure the permissions on the Perl script were to execute. Is
>>there something similar that needs to be done for .ASP files?)


Again...just for clarity...are you dealing with pages that end in .ASP or in .ASPX?
Classic ASP (*.asp) doesn't require much server setup, ASP.Net (*.aspx) requires more...

If it were a permissions issue or a database issue, you would get a message besides "Page cannot  be found".
If you know for certain the page exists, the only way I can think of that you would get that message is if the page has code that is redirecting you to another page....
Thanks for replying so fast.
I am dealing with .asp files (not .aspx) that someone else created a few years ago.

So, it looks like we've figured out that the old server didn't have ASP.NET installed correctly and It didn't really matter, since it was serving just plain old .ASP.

Regarding not seeing the .asp pages "Page cannot be found".  I did a test. I took a basic HTML page that I knew worked and I copied it into another page, naming it test.asp. Then I directed my browser towards that. I got the same "page cannot be found" error message.

I wondering if there is some issue because this new server has ASP.Net on it and these  old pages are just plain .asp pages.

Thoughts?
Just found out the answer as to why I can't see .asp pages. By default, IIS 6.0 has this ability turned off.
Now what I see is an error message from the database. Which is better, I'm making progress.
------------
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
/LM/W3SVC/259194395/Root/global.asa, line 42
-----------------------------

So, now I'm back to, how do I connect an .ASP page to the database.
ASKER CERTIFIED SOLUTION
Avatar of samtran0331
samtran0331
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

I have a follow up question. I've been successful in getting my web pages (asp) to talk to my database (sql 2005).
I followed the advice from samtran  above and created a DSN (Because in looking at the old server, they also had  DSN created).
But here's what I'm wondering. If I didn't create the DSN, would this have worked anyway?
Of course I could delete the DSN and see if it still works, but I'm not crazy.
But I am wondering, how else does a database talk to an .asp file if not through a DSN?
Here's the connect line from my app that is working. Can you tell from looking at this if it's utilizing the DSN?

Application("Web_DBConnString")="Driver={SQL Server};server=localhost;database=mikesdb;uid=mike;pwd=mike;"

This isn't terribly urgent, I'd just like to know what's going on under the hood.

Thanks again,
Mike