Re: Cached Logon
From: Ken Schaefer (kenREMOVE_at_THISadopenstatic.com)
Date: 12/22/04
- Previous message: Roland Hall: "Re: Cached Logon"
- In reply to: Roland Hall: "Re: Cached Logon"
- Next in thread: Roland Hall: "Re: Cached Logon"
- Reply: Roland Hall: "Re: Cached Logon"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 22 Dec 2004 15:28:04 +1100
"Roland Hall" <nobody@nowhere> wrote in message
news:uaDiFu95EHA.1596@tk2msftngp13.phx.gbl...
> "Ken Schaefer" <kenREMOVE@THISadopenstatic.com> wrote in message
> news:uBfCwRi5EHA.3756@TK2MSFTNGP14.phx.gbl...
> : Hi,
> :
> : Your browser is caching the credentials, and resending them for each
> : subsequent page request to that server (until the browser is closed).
>
> The cache was cleared and the browser was closed and still it failed but I
> was prompted each time for credentials but only for the first page.
I think you are completely missing the point, or I am not understanding what
you are saying.
When the browser connects to "firstpage.asp", it first attempts to connect
anonymously (sending no credentials). The webserver sends back a 401 header
(Access Denied) and lists available authentication mechanisms via
WWW-Authenticate HTTP headers.
The browser then prompts the user to supply credentials (or, in the case of
IE, if the website is in the local intranet security zone, will attempt to
send the current logged on user's credentials automatically). The user
supplies their credentials, and the browser sends them to the server. If the
credentials are acceptable, the server sends back a 200 OK status.
The browser then continues to reuse those credentials for subsequent
requests for pages on that site. This is why (I suspect) you are not seeing
credential prompts on subsequent pages. You can not "clear" this cache per
se. Instead, when you close the browser completely, the browser "forgets"
the credentials it has been using. When you open the browser again (well,
technically you need to start a new iexplore.exe process) and hit the site
again, you will once again be prompted for credentials
> : In terms of the login failure - can we see the exact error message that
> : you are seeing please?
>
> Error Type:
> Microsoft OLE DB Provider for SQL Server (0x80040E4D)
> Login failed for user 'sa'.
> /msft/StraightASP.asp, line 7
Well, for some reason SQL Server thinks that the password being supplied by
your ADO connection object is not correct for the "sa" account.
This doesn't have anything to do with IIS caching a logon (for the purposes
impersonating an NT account for processing an ASP page), or with HTTP
authentication between the client and server, which is what your original
post seemed to be talking about. This seems to be an authentication issue
between your ADO components and SQL Server.
That said, if you've cut-n-pasted the code from one working page to another
page, that does seem "out of the norm". Just as a trial, could you put the
connection string into an include file, and include that into your two
pages, and then use the connection string from the include file? That would
probably eliminate some odd non-printable character (or something similar)
being in the connection string. Both pages should either work, or not work.
Cheers
Ken
>
> Here's the whole file. It's not my code. It belongs to MSFT. (password
> removed)
>
> <%@ Language=VBScript %>
> <%
> Function GetRecordset()
> Dim cnn
> Set cnn = CreateObject("ADODB.Connection")
> cnn.Open "Provider=SQLOLEDB.1;Initial Catalog=PUBS;Data Source=localhost",
> "sa", ""
> Set GetRecordset = cnn.Execute("select * from authors")
> End Function
> %>
>
> <html>
> <head>
> <title>Straight ASP Approach</title>
> <link rel="style***" type="text/css" href="default.css">
> </head>
> <body>
>
> <h1>Authors</h1>
>
> <table cellpadding="3" cellspacing="0">
> <tr>
> <th>SSN</th>
> <th>Last Name</th>
> <th>First Name</th>
> <th>Phone</th>
> </tr>
> <%
> Dim rs
> Set rs = GetRecordset()
> do While Not rs.EOF
> %>
> <tr>
> <td><%=rs("au_id")%></td>
> <td><%=rs("au_lname")%></td>
> <td><%=rs("au_fname")%></td>
> <td><%=rs("phone")%></td>
> </tr>
> <%
> rs.MoveNext
> loop
> rs.Close
> Set rs = Nothing
> %>
> </table>
> </body>
> </html>
>
> : Also, are you using a common connection string across all three pages
> (eg
> is
> : the connection string stored in an include file, or in the registry?)
>
> Within the file itself. No include. No reg. See above.
>
> : Or
> : have you hard coded the connection string into all three pages?
>
> Yes, MSFT did.
>
> : If the
> : latter, then I would suggest moving the connection string to a central
> : include file (or application variable), and using that on all three
> pages
> to
> : ensure that you aren't getting a dud connection string on one of the
> pages.
>
> I copied the connection from StraightXML1.asp and pasted it over the one
> in
> StraightASP.asp. Same issue.
>
> I'm not new to this stuff. I experienced something out of the norm and
> was
> wondering if anyone else has also experienced this.
>
> Here is the code from StraightXML1.asp: (password removed)
>
> <%@ Language=VBScript %>
> <!-- #INCLUDE FILE="inc/xmlutil.asp" -->
>
> <%
> Function GetRecordset()
> Dim cnn
> Set cnn = CreateObject("ADODB.Connection")
> cnn.Open "Provider=SQLOLEDB.1;Initial Catalog=PUBS;Data Source=localhost",
> "sa", ""
> Set GetRecordset = cnn.Execute("select * from authors")
> End Function
> %>
>
> <html>
> <head>
> <title>Straight XML Approach</title>
> <link rel="style***" type="text/css" href="default.css">
> </head>
> <body>
> <% = TransformXML( RecordsetToXMLDoc(GetRecordset(), "author"),
> "xsl/authors.xsl" ) %>
> </body>
> </html>
>
> Everything came from here:
> http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/1100/beyondasp/toc.asp
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -
> http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>
- Previous message: Roland Hall: "Re: Cached Logon"
- In reply to: Roland Hall: "Re: Cached Logon"
- Next in thread: Roland Hall: "Re: Cached Logon"
- Reply: Roland Hall: "Re: Cached Logon"
- Messages sorted by: [ date ] [ thread ]