Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 18th, 2003, 10:59 PM
Authorized User
 
Join Date: Jun 2003
Location: St. Louis, Mo., USA.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Redirect page

I am building a redirect page, the lead page give the user a list box of page topics once the user selects the page (which are coming from a database) the redirect should load the page and display it. How ever it is not working. Here is the script I am using, any help would be nice. Request.Form("Stats") will be an int of the HTML page

<%
    Dim intPageForm, FormPage
    intPageForm = Int(Request.Form("Stats"))
    IF intPageForm > 1 then 'Form page selected
        FormPage = "Stats.asp?Form="
        Response.Redirect FormPage + intPageForm Else 'Html page selected
        Response.Redirect Request.Form("Stats")
    End If
%>
  #2 (permalink)  
Old June 19th, 2003, 05:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Quote:
quote:Response.Redirect FormPage + intPageForm Else 'Html page selected
In ASP for string concatenation use "&" instead of "+". So,
Response.Redirect FormPage & intPageForm,
and you don't need Else part of If statement - if user hasn't choosen any page you can't redirect him to some page, so nothing's should happen.

...but the Soon is eclipsed by the Moon
  #3 (permalink)  
Old June 19th, 2003, 09:29 AM
Authorized User
 
Join Date: Jun 2003
Location: St. Louis, Mo., USA.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reminder on the concation, however I am getting the following errors. This happens when I select a static page option:

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "History.htm"]'

/Spartains/Npage.asp, line 5
  #4 (permalink)  
Old June 19th, 2003, 09:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Request.Form("Stats") is the string (one of your option is History.htm as we can see), and you cannot cast it into Int type.
You have to modified your <select> form field in the following manner:
Code:
<select name="Stats">
    <option value=2>History.htm</option>
    <option value=3>SecondPageName.htm</option>
    ...
</select>
...but the Soon is eclipsed by the Moon
  #5 (permalink)  
Old June 20th, 2003, 07:51 PM
Authorized User
 
Join Date: Jun 2003
Location: St. Louis, Mo., USA.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks I changed to the isnumberic function as a switch (I did not know ASP supported this until I looked up the function in the book)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page redirect help jroxit Classic ASP Basics 7 August 11th, 2008 11:01 AM
redirect to page other than default page sarah lee ASP.NET 1.0 and 1.1 Basics 3 December 15th, 2006 05:45 PM
Redirect to new page without closing current page peter2004 ASP.NET 2.0 Basics 5 June 5th, 2006 08:49 PM
Redirect to next page qazi_nomi Javascript How-To 1 September 1st, 2004 02:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.