|
 |
asp_databases thread: Re: passing values with Server.Transfer?
Message #1 by "Jon Cheng" <joncheng2000@y...> on Wed, 25 Jul 2001 11:06:48 -0400
|
|
How do you pass a value to a redirecting page, such as Error.asp, so that it
will display the proper error message when a client enters and erroneous
input.
For example if a client enters a short password, I would like my Error.asp
to say "Sorry, please enter a longer password." Other times it might say
"Sorry, username already exists in database" - or something like that.
How can this be done?
thanks,
-jon
Message #2 by "Eoghan O'Byrne" <Eoghan.O'Byrne@W...> on Wed, 25 Jul 2001 16:18:18 +0100
|
|
Hey Jon,
You can do it by using querystrings. eg.
Error.asp?WRONGPASS=3Dyes&USEREXISTS=3Dyes
IMO its better to keep it short like: WPD for WRONGPASS etc.
Then in your error.asp you use
IF Request.Querystring("WRONGPASS") =3D "yes" THEN
Response.Write "Sorry, please enter the correct password"
ELSEIF Request.Querystring("USEREXISTS") =3D "yes" THEN
Response.Write "Sorry username already exists in database"
END IF
You can add as many values to the querystring as you want just attach
new ones with a & as shown above.
Regards,
Eoghan
-----Original Message-----
From: Jon Cheng [mailto:joncheng2000@y...]
Sent: Wednesday, July 25, 2001 4:07 PM
To: ASP Databases
Subject: [asp_databases] Re: passing values with Server.Transfer?
How do you pass a value to a redirecting page, such as Error.asp, so
that it
will display the proper error message when a client enters and erroneous
input.
For example if a client enters a short password, I would like my
Error.asp
to say "Sorry, please enter a longer password." Other times it might
say
"Sorry, username already exists in database" - or something like that.
How can this be done?
thanks,
-jon
Message #3 by Sam Clohesy <sam@e...> on Wed, 25 Jul 2001 16:39:35 +0100
|
|
Hi Jon,if I were you I would do this stuff client side.
Have a look at http://javascripts.internet.com in the forms bit, there
will
be lots of useful stuff, it will also save return trips to the server.
Hope this is useful
Sam
-----Original Message-----
From: Jon Cheng [mailto:joncheng2000@y...]
Sent: 25 July 2001 16:07
To: ASP Databases
Subject: [asp_databases] Re: passing values with Server.Transfer?
How do you pass a value to a redirecting page, such as Error.asp, so
that it
will display the proper error message when a client enters and
erroneous
input.
For example if a client enters a short password, I would like my
Error.asp
to say "Sorry, please enter a longer password." Other times it might
say
"Sorry, username already exists in database" - or something like that.
How can this be done?
thanks,
-jon
Message #4 by "Eoghan O'Byrne" <Eoghan.O'Byrne@W...> on Wed, 25 Jul 2001 16:41:22 +0100
|
|
However,
I was presuming that you have already verified that the pass was too
short or the user exists so here is the other part,
on your main page you could have,
IF LEN(Request.form("username") < 8) THEN 'where 8 is a minimum
password length
Response.Redirect "Error.asp?WRONGPASS=3Dyes"
END IF
You can use a SQL query to check if the user exists in the table if it
does exist then use an IF THEN similar to the one above to redirect them
to the error page with the appropriate querystring.
Hope this helps,
Eoghan
-----Original Message-----
From: Eoghan O'Byrne [mailto:Eoghan.O'Byrne@W...]
Sent: Wednesday, July 25, 2001 4:18 PM
To: ASP Databases
Subject: [asp_databases] Re: passing values with Server.Transfer?
Hey Jon,
You can do it by using querystrings. eg.
Error.asp?WRONGPASS=3Dyes&USEREXISTS=3Dyes
IMO its better to keep it short like: WPD for WRONGPASS etc.
Then in your error.asp you use
IF Request.Querystring("WRONGPASS") =3D "yes" THEN
Response.Write "Sorry, please enter the correct password"
ELSEIF Request.Querystring("USEREXISTS") =3D "yes" THEN
Response.Write "Sorry username already exists in database"
END IF
You can add as many values to the querystring as you want just attach
new ones with a & as shown above.
Regards,
Eoghan
-----Original Message-----
From: Jon Cheng [mailto:joncheng2000@y...]
Sent: Wednesday, July 25, 2001 4:07 PM
To: ASP Databases
Subject: [asp_databases] Re: passing values with Server.Transfer?
How do you pass a value to a redirecting page, such as Error.asp, so
that it
will display the proper error message when a client enters and erroneous
input.
For example if a client enters a short password, I would like my
Error.asp
to say "Sorry, please enter a longer password." Other times it might
say
"Sorry, username already exists in database" - or something like that.
How can this be done?
thanks,
-jon
Message #5 by "Jon Cheng" <joncheng2000@y...> on Wed, 25 Jul 2001 12:11:12 -0400
|
|
Thanks Eoghan,
I thought about that idea already, but since most of my asp pages don't use
the GET method, I would like a solution without the GET method. I was
wondering if there is anything in ado that can handle this, before I dig
into javascripts.
oh and, http://javascripts.internet.com/ doesn't seem to work.
thanks,
-jon
----- Original Message -----
From: "Eoghan O'Byrne" <Eoghan.O'Byrne@W...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, July 25, 2001 11:41 AM
Subject: [asp_databases] Re: passing values with Server.Transfer?
> However,
> I was presuming that you have already verified that the pass was too
> short or the user exists so here is the other part,
>
> on your main page you could have,
>
> IF LEN(Request.form("username") < 8) THEN 'where 8 is a minimum
> password length
> Response.Redirect "Error.asp?WRONGPASS=yes"
> END IF
>
> You can use a SQL query to check if the user exists in the table if it
> does exist then use an IF THEN similar to the one above to redirect them
> to the error page with the appropriate querystring.
>
> Hope this helps,
>
> Eoghan
>
> -----Original Message-----
> From: Eoghan O'Byrne [mailto:Eoghan.O'Byrne@W...]
> Sent: Wednesday, July 25, 2001 4:18 PM
> To: ASP Databases
> Subject: [asp_databases] Re: passing values with Server.Transfer?
>
>
> Hey Jon,
>
> You can do it by using querystrings. eg.
>
> Error.asp?WRONGPASS=yes&USEREXISTS=yes
>
> IMO its better to keep it short like: WPD for WRONGPASS etc.
>
> Then in your error.asp you use
>
> IF Request.Querystring("WRONGPASS") = "yes" THEN
> Response.Write "Sorry, please enter the correct password"
> ELSEIF Request.Querystring("USEREXISTS") = "yes" THEN
> Response.Write "Sorry username already exists in database"
> END IF
>
> You can add as many values to the querystring as you want just attach
> new ones with a & as shown above.
>
> Regards,
>
> Eoghan
>
> -----Original Message-----
> From: Jon Cheng [mailto:joncheng2000@y...]
> Sent: Wednesday, July 25, 2001 4:07 PM
> To: ASP Databases
> Subject: [asp_databases] Re: passing values with Server.Transfer?
>
>
> How do you pass a value to a redirecting page, such as Error.asp, so
> that it
> will display the proper error message when a client enters and erroneous
> input.
>
> For example if a client enters a short password, I would like my
> Error.asp
> to say "Sorry, please enter a longer password." Other times it might
> say
> "Sorry, username already exists in database" - or something like that.
>
> How can this be done?
>
> thanks,
> -jon
>
> ---
Message #6 by "Ken Schaefer" <ken@a...> on Thu, 26 Jul 2001 13:19:37 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Jon Cheng" <joncheng2000@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, July 26, 2001 2:11 AM
Subject: [asp_databases] Re: passing values with Server.Transfer?
: Thanks Eoghan,
: I thought about that idea already, but since most of my asp pages don't
use
: the GET method, I would like a solution without the GET method. I was
: wondering if there is anything in ado that can handle this, before I dig
: into javascripts.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GET is a method of the browser :-) The browser issues a GET to the server to
get a page. :-). I think you'll find that most of your site works that way
already (either that, or POST).
The other options involve:
a) setting cookies
b) using session variables (which depend on cookies)
But I think passing some indicator in the URL is the most efficient:
page1.asp?Err=1
and you could do a lookup to get the corresponding error message.
Cheers
Ken
|
|
 |