Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on redirecting 1

Status
Not open for further replies.

keain

MIS
Joined
Nov 21, 2002
Messages
99
Location
US
OK. Trying to get the hang of ASP here. I've created an entry screen where when a correct customer number is used the customer info is pulled. However, when an incorrect number is entered is where I'm having problems.

I can do one of the following, but not both:

Use response.write to send a message saying that the customer number was invalid.

OR

Use response.redirect or server.transfer to send the user back to the entry screen (which is htm).

I want to have the user return to the entry screen with a message saying that the number was incorrect, please enter another.

Sorry for such a basic question, but MS's knowledgebase wasn't helpful.
 
You can't dynamically display a message in a HTM file! Change it to an ASP file.

Put your message in a session variable and then use Server.Transfer(), in your target page check for the session variable, if it is there display it and delete it.

Code:
<!-- file customer_number_entry.asp -->
<%
  if( something is not right){ 
    Session(&quot;errMsg&quot;) = &quot;Something is not right&quot;;
    Server.Transfer(&quot;opening.asp&quot;);
  }    
%>

<!-- file opening.asp -->
<%
  var errMsg = new String(Session(&quot;errMsg&quot;));
  if( errMsg.length > 0){
    Session(&quot;errMsg&quot;) = &quot;&quot;;
}
<div><%=errMsg%></div>
<% }  // if( errMsg.length) %>
... rest of page

-pete
I just can't seem to get back my IntelliSense
 
Pete,

Thanks. I implemented that and it worked! I made a couple minor changes, but nothing big.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top