Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Session variable usage?

Reply
Thread Tools

Session variable usage?

 
 
McKirahan
Guest
Posts: n/a
 
      03-24-2005
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.


 
Reply With Quote
 
 
 
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      03-24-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      03-24-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
McKirahan
Guest
Posts: n/a
 
      03-24-2005
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:#(E-Mail Removed)...
> 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.



 
Reply With Quote
 
McKirahan
Guest
Posts: n/a
 
      03-24-2005
"Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      03-24-2005
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Session Variable VS. Own-declared 'Session' Variable chowchho ASP .Net 7 03-28-2008 02:38 PM
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
s there a way to set a session variable by session ID? admiller97@gmail.com ASP .Net 1 11-14-2005 05:13 PM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM



Advertisments