Consolidate asp pages

Discussion in 'ASP General' started by Terri, Apr 19, 2004.

  1. Terri

    Terri Guest

    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
    Terri, Apr 19, 2004
    #1
    1. Advertising

  2. 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 " %>


    --
    William Morris
    Semster, Seamlyne reProductions
    Visit our website, http://www.seamlyne.com, for the most comfortable
    historically inspired clothing you can buy!


    "Terri" <> wrote in message
    news:c61fde$cj8$...
    > 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
    >
    >
    >
    William Morris, Apr 19, 2004
    #2
    1. Advertising

  3. Terri

    Jeff Cochran Guest

    On Mon, 19 Apr 2004 14:50:43 -0600, "Terri" <>
    wrote:

    >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
    Jeff Cochran, Apr 20, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Manish
    Replies:
    1
    Views:
    634
    Steve C. Orr [MVP, MCSD]
    Nov 17, 2003
  2. Ryan Taylor
    Replies:
    3
    Views:
    886
    Hermit Dave
    Sep 29, 2004
  3. Edmond wong
    Replies:
    0
    Views:
    381
    Edmond wong
    Apr 14, 2005
  4. Replies:
    0
    Views:
    95
  5. Starriol
    Replies:
    5
    Views:
    111
    Mark Lawrence
    Oct 11, 2013
Loading...

Share This Page