Sunday, March 25, 2012

Accessing data connection works locally, but not when deployed

Hi all, I hope this is a simple issue that I'm overlooking something or have contradicting permissions set somewhere. I have a fairly basic site with a subfolder containing an aspx page. The user logs in to gain access to the subfolder. That part works fine.
On another page(also within a subfolder in the subfolder), they can post form data to a database (SQL Server 2000) which exists on a different server than my web server. This page opens fine, but when submitting the data (only one value to one field for my testing purposes), it bombs and returns the error "Login failed for user"...
In my connection string I've specified the username and password which I assigned to the db in Enterprise Manager (not sa, btw). I've also tried letting IIS control the UID/PW, and even specified no UID/PW in either the connection string or the db. Anonymous access enabled in IIS for this virtual directory also returns the error. (?)
I should mention that in Visual Studio, the connection string was automatically set to my local development machine's workstation ID. I removed that and have tried replacing it with the server name, blank, etc.(in notepad) - to no avail. dll's are in their proper places, etc. The only thing not working is the database connection.
Using: IIS v6, SQL Server 2000, and Visual Studio.NET 2003 (1.1 framework)
Anyway - any suggestions? There are so many places to enable/disable permissions, it's getting confusing. I hope it's something I'm overlooking and not a problem with our SQL installation...
Thanks!
--DonnieI'm no longer getting the error when I press Submit, although now I need to figure out why the data isn't writing to the table. I think the problem now is in my query parameters. Here's what I did:
Recreated the DB and tables; recreated the SqlConnection in Visual Studio.
In IIS, I set the permissions to anonymous access using the IUSR_(mySERVER) (where server=the name of my web server)
In Enterprise Manager, I made the aspuser account the dbo on the database.(yep, I know this is not the best way...)
In my ASP.NET pages, I am using forms authentication and denying access to anonymous users (does this contradict the IIS setting? Should anonymous access be unchecked in IIS?)
I'm aware there are more than likely some security issues with this setup and will be working through the various posts and links here to fix them. This is a great site and it looks like I have a lot to learn, and will hopefully learn a lot here!
--Donnie|||Can you post the connection string (xxxx out the user id and password) and the code that does the data access?
Thanks,
Tyler

No comments:

Post a Comment