Ask a Question related to ASP Database, Design and Development.
-
Fred #1
Random connection pb with ASP and Access
Hello,
My asp web site is based on MS Access to get the login and password.
It works fine in the test environment, but randomly fails in production
(works fine, once, but if I come back five minutes later, it redirects to
the error login page with the same correct username and password., then five
minutes later, works fine again...)
In IIS5 log, I have sc-status 302 and 500 ?!?
Should I start a pool connexion, would that help ? This is very wired...
Thanks in advance for your ideas
Fred
Fred Guest
-
random records from Access?
Hi I'm using a Windows 2003 server an access database, with ODBC connection Is there anywhere I can find info about displaying all records in... -
random order results from MS access database
simple question but how could I go about order by search results randomly every time the page loads, or even better set it up so that each time the... -
ASP DSN-less connection to Access
Dear All, I have IIS running on Windows XP Pro. On the server is a Access database and my ASP pages all under the 'wwwroot folder'. I have a... -
Access DB Connection problems
Ok, I'm pretty new to this, so please be patient. Here the story. I've got a very simple access database used for people to enroll in training... -
ASP & Access connection
Hi, Is it possible to connect to Access file located on another web server using ASP 3.0? Thanx, Neven -
Martin CLAVREUIL #2
Re: Random connection pb with ASP and Access
hello,
is your connexion object in the session pool or application one ?
acceess will fails if you try to connect 2 connections in R/W mode in the
same time.
try with an application level connection.
"Fred" <back@boursorama.com> a écrit dans le message de
news:ukfmPUXcDHA.1540@tk2msftngp13.phx.gbl...five> Hello,
>
> My asp web site is based on MS Access to get the login and password.
> It works fine in the test environment, but randomly fails in production
> (works fine, once, but if I come back five minutes later, it redirects to
> the error login page with the same correct username and password., then> minutes later, works fine again...)
> In IIS5 log, I have sc-status 302 and 500 ?!?
> Should I start a pool connexion, would that help ? This is very wired...
> Thanks in advance for your ideas
> Fred
>
>
Martin CLAVREUIL Guest
-
Frederic BACK #3
Re: Random connection pb with ASP and Access
Thank you Martin for your quick answer.
Here is how I manage the access (Thru an ODBC connexion to MS Access,
the connexion pool is not activated, should I ?). For your information,
the try to connect are not simultaneous. Sometimes, the users can log
for 15 minutes, and the suddenly, it doesn't work anymore for some time,
and then, it works again...
Thank you for your help. I'm becoming crazy...
Regards
Fred
// *** Validate request to log in to this site.
var MM_LoginAction = Request.ServerVariables("URL");
if (Request.QueryString!="") MM_LoginAction += "?" +
Request.QueryString;
var MM_valUsername=String(Request.Form("txtUtilisateur "));
if (MM_valUsername != "undefined") {
var MM_fldUserAuthorization="niveau_acces";
var MM_redirectLoginSuccess="accueil_utilisateur.asp";
var MM_redirectLoginFailed="erreur_identification.asp" ;
var MM_flag="ADODB.Recordset";
var MM_rsUser = Server.CreateObject(MM_flag);
MM_rsUser.ActiveConnection = MM_Administrateur_STRING;
MM_rsUser.Source = "SELECT nom_utilisateur, password";
if (MM_fldUserAuthorization != "") MM_rsUser.Source += "," +
MM_fldUserAuthorization;
MM_rsUser.Source += " FROM responsable WHERE nom_utilisateur='" +
MM_valUsername + "' AND password='" +
String(Request.Form("txtMotdePasse")) + "'";
MM_rsUser.CursorType = 0;
MM_rsUser.CursorLocation = 2;
MM_rsUser.LockType = 3;
MM_rsUser.Open();
if (!MM_rsUser.EOF || !MM_rsUser.BOF) {
// username and password match - this is a valid user
Session("MM_Username") = MM_valUsername;
if (MM_fldUserAuthorization != "") {
Session("MM_UserAuthorization") =
String(MM_rsUser.Fields.Item(MM_fldUserAuthorizati on).Value);
} else {
Session("MM_UserAuthorization") = "";
}
if (String(Request.QueryString("accessdenied")) != "undefined" &&
false) {
MM_redirectLoginSuccess = Request.QueryString("accessdenied");
}
MM_rsUser.Close();
Response.Redirect(MM_redirectLoginSuccess);
}
MM_rsUser.Close();
Response.Redirect(MM_redirectLoginFailed);
}
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Frederic BACK Guest
-
Bob Barrows #4
Re: Random connection pb with ASP and Access
Sorry, but - never use an application-level connection:
[url]http://www.learnasp.com/learn/sessionoverview.asp[/url]
[url]http://www.learnasp.com/advice/dbsessionapp.asp[/url]
[url]http://www.learnasp.com/learn/globalproblems.asp[/url]
[url]http://www.learnasp.com/learn/stateproscons.asp[/url]
OLEDB implements connection pooling. There is no need to serialize database
access by tying all users to a single database connection.
Bob Barrows
"Martin CLAVREUIL" <martin.clavreuil@wanadoo.fr> wrote in message
news:O7yahxccDHA.2672@tk2msftngp13.phx.gbl...to> hello,
>
> is your connexion object in the session pool or application one ?
> acceess will fails if you try to connect 2 connections in R/W mode in the
> same time.
> try with an application level connection.
>
> "Fred" <back@boursorama.com> a écrit dans le message de
> news:ukfmPUXcDHA.1540@tk2msftngp13.phx.gbl...> > Hello,
> >
> > My asp web site is based on MS Access to get the login and password.
> > It works fine in the test environment, but randomly fails in production
> > (works fine, once, but if I come back five minutes later, it redirects> five> > the error login page with the same correct username and password., then>> > minutes later, works fine again...)
> > In IIS5 log, I have sc-status 302 and 500 ?!?
> > Should I start a pool connexion, would that help ? This is very wired...
> > Thanks in advance for your ideas
> > Fred
> >
> >
>
Bob Barrows Guest
-
Bob Barrows #5
Re: Random connection pb with ASP and Access
Very tough to troubleshoot without seeing code ...
"Fred" <back@boursorama.com> wrote in message
news:ukfmPUXcDHA.1540@tk2msftngp13.phx.gbl...five> Hello,
>
> My asp web site is based on MS Access to get the login and password.
> It works fine in the test environment, but randomly fails in production
> (works fine, once, but if I come back five minutes later, it redirects to
> the error login page with the same correct username and password., then> minutes later, works fine again...)
> In IIS5 log, I have sc-status 302 and 500 ?!?
> Should I start a pool connexion, would that help ? This is very wired...
> Thanks in advance for your ideas
> Fred
>
>
Bob Barrows Guest
-
Bob Barrows #6
Re: Random connection pb with ASP and Access
You do not seem to be handling failures to connect to the database, so it is
unclear whether the problem is database connectivity, or another problem
such as losing session variable values, or failing to pass the correct
querystring value, or something else entirely.
You should be explicitly creating and opening a Connection object rather
than setting the recordset's activeconnection property to a connection
string. This will allow you to catch any error that occur when opening the
connection using Try.
I'm not familiar enough with javascript to suggest improvements. Hopefully
someone else can jump in.
See inline response:
"Frederic BACK" <back@boursorama.com> wrote in message
news:u3rjQ$dcDHA.2432@TK2MSFTNGP10.phx.gbl...This statement does not seem to be correct. You should be using a logical>
> Thank you Martin for your quick answer.
>
> Here is how I manage the access (Thru an ODBC connexion to MS Access,
> the connexion pool is not activated, should I ?). For your information,
> the try to connect are not simultaneous. Sometimes, the users can log
> for 15 minutes, and the suddenly, it doesn't work anymore for some time,
> and then, it works again...
> Thank you for your help. I'm becoming crazy...
> Regards
> Fred
>
> // *** Validate request to log in to this site.
> var MM_LoginAction = Request.ServerVariables("URL");
> if (Request.QueryString!="") MM_LoginAction += "?" +
> Request.QueryString;
> var MM_valUsername=String(Request.Form("txtUtilisateur "));
> if (MM_valUsername != "undefined") {
> var MM_fldUserAuthorization="niveau_acces";
> var MM_redirectLoginSuccess="accueil_utilisateur.asp";
> var MM_redirectLoginFailed="erreur_identification.asp" ;
> var MM_flag="ADODB.Recordset";
> var MM_rsUser = Server.CreateObject(MM_flag);
> MM_rsUser.ActiveConnection = MM_Administrateur_STRING;
> MM_rsUser.Source = "SELECT nom_utilisateur, password";
> if (MM_fldUserAuthorization != "") MM_rsUser.Source += "," +
> MM_fldUserAuthorization;
> MM_rsUser.Source += " FROM responsable WHERE nom_utilisateur='" +
> MM_valUsername + "' AND password='" +
> String(Request.Form("txtMotdePasse")) + "'";
> MM_rsUser.CursorType = 0;
> MM_rsUser.CursorLocation = 2;
> MM_rsUser.LockType = 3;
> MM_rsUser.Open();
> if (!MM_rsUser.EOF || !MM_rsUser.BOF) {
AND (&&) here, not OR (||). You want both EOF and BOF to be false, not just
one or the other. Actually, since you've just opened the recordset, all you
need to check for is EOF, since a recordset will always be pointing at the
first record if it has records immediately after opening.
Bob Barrows
Bob Barrows Guest
-
Bob Barrows #7
Re: Random connection pb with ASP and Access
See my other response. You have no way of knowing from this code whether the
redirect is due to a database connection failure, or some other cause.
Bob Barrows
Frederic BACK wrote:> Sorry Bob, here are some other elements.
> I added in my code "response.buffer=true" Do you think it might help ?
>
> Here is how I manage the access (Thru an ODBC connexion to MS Access,
> the connexion pool is not activated, should I ?). For your
> information, the try to connect are not simultaneous. Sometimes, the
> users can log for 15 minutes, and the suddenly, it doesn't work
> anymore for some time, and then, it works again...
> Thank you for your help. I'm becoming crazy...
> Regards
> Fred
> <%@LANGUAGE="JAVASCRIPT"%>
> <!--#include file="Connections/Administrateur.asp" -->
> <%
> // *** Validate request to log in to this site.
> Response.buffer = true;
> var MM_LoginAction = Request.ServerVariables("URL");
> if (Request.QueryString!="") MM_LoginAction += "?" +
> Request.QueryString;
> var MM_valUsername=String(Request.Form("txtUtilisateur "));
> if (MM_valUsername != "undefined") {
> var MM_fldUserAuthorization="niveau_acces";
> var MM_redirectLoginSuccess="accueil_utilisateur.asp";
> var MM_redirectLoginFailed="erreur_identification.asp" ;
> var MM_flag="ADODB.Recordset";
> var MM_rsUser = Server.CreateObject(MM_flag);
> MM_rsUser.ActiveConnection = MM_Administrateur_STRING;
> MM_rsUser.Source = "SELECT nom_utilisateur, password";
> if (MM_fldUserAuthorization != "") MM_rsUser.Source += "," +
> MM_fldUserAuthorization;
> MM_rsUser.Source += " FROM responsable WHERE nom_utilisateur='" +
> MM_valUsername + "' AND password='" +
> String(Request.Form("txtMotdePasse")) + "'";
> MM_rsUser.CursorType = 0;
> MM_rsUser.CursorLocation = 2;
> MM_rsUser.LockType = 3;
> MM_rsUser.Open();
> if (!MM_rsUser.EOF || !MM_rsUser.BOF) {
> // username and password match - this is a valid user
> Session("MM_Username") = MM_valUsername;
> if (MM_fldUserAuthorization != "") {
> Session("MM_UserAuthorization") =
> String(MM_rsUser.Fields.Item(MM_fldUserAuthorizati on).Value);
> } else {
> Session("MM_UserAuthorization") = "";
> }
> if (String(Request.QueryString("accessdenied")) != "undefined" &&
> false) {
> MM_redirectLoginSuccess = Request.QueryString("accessdenied");
> }
> MM_rsUser.Close();
> Response.Redirect(MM_redirectLoginSuccess);
> }
> MM_rsUser.Close();
> Response.Redirect(MM_redirectLoginFailed);
> }
>
>
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Bob Barrows Guest



Reply With Quote

