Consolidate asp pages

T

Terri

I have 3 asp pages.

Subscribe.asp passes form input to a page that processes the form data with
<form method="POST" name = "form1" action="ProcessSubscribe.asp">

ProcessSubscribe.asp checks to see if the form input already exists in a
table. If the data exists the page is redirected with Response.Redirect
"Error.asp".

I'd like to eliminate the error.asp page, redirect the user back to the main
page with Response.Redirect "Subscribe.asp", and display an error message
above the form input box.

How can I display an error message on Subscribe.asp only when the user is
redirected back to the page and not on initial load of the page?

Thanks
 
W

William Morris

Easy simple. Pass the error message back to the first page in the
querystring:

response.redirect "subscribe.asp?errMsg=" & server.urlencode("Yo, man, you
can't get there from here!")

On subscribe.asp you have code like this:

<% if len(trim(request("errMsg") & " ")) > 0 then %>
<div align=center style="border: 1px solid red; padding: 10px">
<%=request("errMsg")%>
</div>
<% end if %>

It's aircode and syntactically untested, but in general theory it works.

<% =" - Wm " %>
 
J

Jeff Cochran

I have 3 asp pages.

Subscribe.asp passes form input to a page that processes the form data with
<form method="POST" name = "form1" action="ProcessSubscribe.asp">

ProcessSubscribe.asp checks to see if the form input already exists in a
table. If the data exists the page is redirected with Response.Redirect
"Error.asp".

I'd like to eliminate the error.asp page, redirect the user back to the main
page with Response.Redirect "Subscribe.asp", and display an error message
above the form input box.

How can I display an error message on Subscribe.asp only when the user is
redirected back to the page and not on initial load of the page?

An easy method is a session variable. Something "Authenticated"
Check the session and if it's set to No then display the error. Set
it to No if it's not Yes or No after checking, and then display the
login. Then if they Authenticate set it to Yes and on each page check
again, if it's yes display the page otherwise do a Response.Redirect
to the login page.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top