Web page Security issues?

  • Greetings!

    Okay, I am having a problem accessing the database from a web page. I use ADO with a DSN-less connection.

    This is the error I am getting.

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)

    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'WEBDEV1\IUSR_WEBDEV1'.

    Any ideas on what I need to do? Be basic! I am not the one who usually sets up security and such with SQL Server.

    Any ideas?

    Thanks!

    turlough

    Edited by - turlough on 07/15/2002 09:50:16 AM

  • Don't know why this posted twice.

    Thanks for any help!

    turlough

  • Are you SQL Server and IIS site on the same server?

    The IUSR account is the anom access account for IIS. Hence it is trying to use NT auth to access the sql server.

    If they are on different boxes try using sql security not NT, or if they are on the same box setup the IUSR account with access to the sql server

    Steven

  • Thanks for the reply!

    Okay, there is an IUSR_<compname> setup on the computer. It has guest permissions. Is that correct?

    Also, I can't connect to the SQL database in SQL Query except through windows verification. Even sa (no password) doesn't work! (Error 18452, not associated with a trusted SQL Server connection.) Does this mean my user accounts are set up wrong? Both the database and web page are on the same box (my desktop). IIS seems to be running fine as some other web pages work.

    btw, I don't know much about the domain setup here. Could that be interfering with anything?

    Any ideas would be great!

    Thanks!

    turlough

  • you will need to check the database to see if the 'guest permissions' are enough for your application.

    Your sql server may be setup for NT auth only rather than mixed mode, which will allow the sa account to work.

    The domain setup should not be an issue because they are both IIS and SQL are on the same box.

    You could run sql profiler against your sql server, then run your web application to see what t-sql commands are being fired against your sql server etc.

    Then mirror the t-sql in query analyser. Use the setuser command to give yourself the same rights are your iusr account.

    Steven

  • Again, thanks!

    Hmmm. I have SQL set for mixed mode. When I go to Query Analyzer, I can use my domain logon name and it is just fine. When I try to use any of the users I have set up or sa, it doesn't work.

    What did you mean by running the web app to see the t-sql commands? I created the web page and it is just a connection and a very simple SELECT statement that is running. Again, though, due to the error, the connection attempt with ADO fails because it doesn't like the user name and password.

    Thanks again for the reply!

    turlough

  • You can use sql profiler to capture all the t-sql commands sent to a sql server. Hence if you run that, you can find out what your web app is doing.

    Also you may want to create your connection string via a UDL (so you know it doesn't have any typo's. (Create an empty file with an extension of udl) Double click on it, and as long as you have mdac 2.1sp2 or above you will see a connection wizard). Once you have a working UDL (use the test connection) you can load it into notepad, then cut and paste the connection into your web page

    Steven

  • Are you wanting to use the IUSR_ account to log in to SQL or are you just wanting to log in?

    The way a connection is made is determined by you ADODB.connection object string.

    Ex. To login with a SQL account Fred, with password "youcanguess". On possible way to do this is like so in the ASP.

    Set Conn = Server.CreateObject("ADODB.Connection")

    Conn.Open "Provider=SQLOLEDB.1;Initial Catalog=DBNameHere;App=AppNameHere;Data Source=ServerAddressHereNameOrIP", "Fred", "youcanguess"

    That is a sql account connection.

    If you want to use you IUSR_ account then it will need to be given access to the SQL Server. If the server are on the same box then it will not be much of an issue. If they are on seperate boxes you need a domain account (might be able to still use local accounts but I have not tried). Then your connection string should look like so (sorry not done this but basics are right for sure).

    Set Conn = Server.CreateObject("ADODB.Connection")

    Conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DBNameHere;App=AppNameHere;Data Source=ServerAddressHereNameOrIP"

    This should get you past the login issue.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Greetings!

    Again, thanks for the replies!

    In general, I connect to the database using a DSN-less connection. In that, then, is the uid and pwd information. (What is AppName for? I don't know that I have used that before!) I have done this before and it works.

    Except this time.

    No matter what I did, I couldn't get connected to the database. Yet, it was no different than what I have used on pages before. Maybe it is some network setting or something? That's the only thing I can think of.

    Again, thanks for the replies and ideas!

    turlough

  • AppName is not required, I personally choose to use it so I can identify what website or application is connecting. This gives me more detail when troubleshooting issues. As for yours it has to be in your connection parameters. If you will post them it would help us help you (substitute security items for soemthing else).

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Need more help, check out this link from microsoft product support services:

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q247931

    FYI

    When getting sql errors like this, copy the error message in the browser address bar and click go. This should give you a list of search results and have at it.

    Bubba

  • I'm experiencing a minor but frustrating problem...

    One of my SQL Server boxes is used for testing. I can get into this Server just fine as 'sa'. I can get into this Server just fine using Windows authentication, as my Windows domain user.

    What I need to do, but can't, is use BCP or ISQL from a command line to connect with this server using my Windows authentication, as my Windows domain user.

    I have seen this problem one other time, with a different user and server. No other Windows-authenticated users here have trouble getting in, just mine. Obviously, the server is set up for both SQL Server and Windows authentication, or no one could get in with Windows authentication.

    I have been spelunking Google and the various boards, to no avail. Any ideas?

    Thanks,

    Lee

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply