| Author |
Session variable usage?
|
|
| McKirahan 2005-03-24, 3:55 pm |
| Is there a way to use a Session Variable to prevent
the successful resubmission of a form if the user
uses the Back button and tries to submit it again?
Thanks in advance.
| |
| Curt_C [MVP] 2005-03-24, 3:55 pm |
| have a look on www.aspfaq.com
There are some good explanations of how to properly adjust for the back
buttons usage.
--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"McKirahan" <News@McKirahan.com> wrote in message
news:HtSdnaqKe8iklt7fRVn-ow@comcast.com...
> Is there a way to use a Session Variable to prevent
> the successful resubmission of a form if the user
> uses the Back button and tries to submit it again?
>
> Thanks in advance.
>
>
| |
| Aaron [SQL Server MVP] 2005-03-24, 3:55 pm |
| Um, yeah. On the form page:
<%
if request.form("whatever") <> "" and not (session("already_submitted"))
then
' do your thing with the data
session("already_submitted") = true
else
' form was empty, or already submitted
end if
%>
--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"McKirahan" <News@McKirahan.com> wrote in message
news:HtSdnaqKe8iklt7fRVn-ow@comcast.com...
> Is there a way to use a Session Variable to prevent
> the successful resubmission of a form if the user
> uses the Back button and tries to submit it again?
>
> Thanks in advance.
>
>
| |
| Ray Costanzo [MVP] 2005-03-24, 3:55 pm |
| Yeah, you could do that if you want, I suppose.
<% If Session("AlreadySubmitted") = "" Then %>
<form method="post" action="yourpage.asp">
<% Else %>
Already submitted
<% End If %>
You'd want to use that in conjunction with anti-caching headers.
http://www.aspfaq.com/show.asp?id=2017
http://www.aspfaq.com/show.asp?id=2022
Ray at work
"McKirahan" <News@McKirahan.com> wrote in message
news:HtSdnaqKe8iklt7fRVn-ow@comcast.com...
> Is there a way to use a Session Variable to prevent
> the successful resubmission of a form if the user
> uses the Back button and tries to submit it again?
>
> Thanks in advance.
>
>
| |
| McKirahan 2005-03-24, 8:55 pm |
| "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:#3vNxMKMFHA.3336@TK2MSFTNGP09.phx.gbl...
> Yeah, you could do that if you want, I suppose.
>
> <% If Session("AlreadySubmitted") = "" Then %>
> <form method="post" action="yourpage.asp">
> <% Else %>
> Already submitted
> <% End If %>
>
> You'd want to use that in conjunction with anti-caching headers.
>
> http://www.aspfaq.com/show.asp?id=2017
> http://www.aspfaq.com/show.asp?id=2022
>
> Ray at work
Thanks to all; especially Ray as it was the "anti-caching headers"
approach that I needed.
I misstated my problem as I had solved that one yesterday;
I basically came up with Aaron's solution.
Today's problem was, basically, how to prevent the user from
backing in to a secure page after logging out.
| |
| McKirahan 2005-03-24, 8:55 pm |
| "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:uscp7KKMFHA.3076@TK2MSFTNGP14.phx.gbl...
> Um, yeah. On the form page:
>
> <%
> if request.form("whatever") <> "" and not
(session("already_submitted"))
> then
> ' do your thing with the data
> session("already_submitted") = true
> else
> ' form was empty, or already submitted
> end if
> %>
>
> --
> Please post DDL, sample data and desired results.
> See http://www.aspfaq.com/5006 for info.
I wondered why you added:
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
until I saw it was your response to "error message" so I'll ignore it :)
| |
| Aaron [SQL Server MVP] 2005-03-24, 8:55 pm |
| > I wondered why you added:
>
> Please post DDL, sample data and desired results.
> See http://www.aspfaq.com/5006 for info.
It's just my signature. Most of my time is spent in the SQL Server groups,
where a gentle reminder is not enough to drive this point home. I figure
the more exposure this page gets, the fewer questions we'll get that start
with "I have this table with a couple of varchar columns..."
--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
|
|
|
|