select case not working

Discussion in 'ASP .Net' started by mark.irwin@myrapidsys.com, Sep 27, 2005.

  1. Guest

    Hello all,

    Have an issue where a redirect pushes data to a page with a select case
    which then redirects to another page. Problem is the redirect isnt
    working in 1 case. Code below:

    strURL = ""

    if i = 1 then
    strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
    "&year=" & lbYear.text
    elseif i > 1 then
    strURL = "redirect.aspx?page=dockm&docket=" & tbSubDocket.text &
    "&page=" & tbSubPage.text <====== PROBLEM STARTS HERE
    end if

    if strURL <> "" then
    response.redirect(strURL)
    end if


    redirect.aspx code here:

    select case request.QueryString("page")

    case "stridx"
    session("sname")= request.querystring("sname")

    response.Redirect("stridx.aspx")

    case "APIQ"
    session("parcel") = request.QueryString("parcel")
    session("year") = request.QueryString("year")

    response.Redirect("APIQ.aspx")
    case "pdssub"
    session("map") = request.QueryString("rmap")
    session("plat") = request.QueryString("rplat")

    response.Redirect("pdssub.aspx")
    case "dockm"
    session("docket")= request.QueryString("docket")
    session("page") = request.QueryString("page")

    response.Redirect("asrdockm.aspx")
    case else
    response.Write("WHAT THE CRAP!!?!?!??!")

    end select

    the case statement i am having problems with is the dockm statement
    code skips over it and goes to the else statement
    all the other case statements work great

    if i substitue dockm for APIQ in the URL string i get the same behavior

    this works:
    strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
    "&year=" & lbYear.text

    this doesnt:
    strURL = "redirect.aspx?page=dockm&docket=" & tbSubDocket.text &
    "&page=" & tbSubPage.text

    and modifying to this doesnt work either:
    strURL = "redirect.aspx?page=APIQ&docket=" & tbSubDocket.text &
    "&page=" & tbSubPage.text
    (just changed page value to APIQ)

    goes straight to else statement

    Can anyone help with this?

    Thanks in advance
     
    , Sep 27, 2005
    #1
    1. Advertising

  2. Bruce Barker Guest

    you have a lot of bugs:

    1) case sensitive compares
    2) failure to urlen encode data

    strURL = ""

    if i = 1 then
    strURL = string.Format("redirect.aspx?page=APIQ&parcel={0}&year={1}",
    HttpUtility.UrlEncode(strParcel),
    HttpUtility.UrlEncode(lbYear.text))
    elseif i > 1 then
    strURL = string.Format("redirect.aspx?page=dockm&docket={0}&page={1}",
    HttpUtility.UrlEncode(tbSubDocket.text),
    HttpUtility.UrlEncode(tbSubPage.text))
    end if
    if strURL <> "" then
    response.redirect(strURL)
    end if

    redirect.aspx code here:

    select case request.QueryString("page").ToLower()
    case "stridx"
    session("sname")= request.querystring("sname")
    response.Redirect("stridx.aspx")
    case "apiq"
    session("parcel") = request.QueryString("parcel")
    session("year") = request.QueryString("year")
    response.Redirect("APIQ.aspx")
    case "pdssub"
    session("map") = request.QueryString("rmap")
    session("plat") = request.QueryString("rplat")
    response.Redirect("pdssub.aspx")
    case "dockm"
    session("docket")= request.QueryString("docket")
    session("page") = request.QueryString("page")
    response.Redirect("asrdockm.aspx")
    case else
    response.Write("WHAT THE CRAP!!?!?!??!")
    end select



    <> wrote in message
    news:...
    > Hello all,
    >
    > Have an issue where a redirect pushes data to a page with a select case
    > which then redirects to another page. Problem is the redirect isnt
    > working in 1 case. Code below:
    >
    > strURL = ""
    >
    > if i = 1 then
    > strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
    > "&year=" & lbYear.text
    > elseif i > 1 then
    > strURL = "redirect.aspx?page=dockm&docket=" & tbSubDocket.text &
    > "&page=" & tbSubPage.text <====== PROBLEM STARTS HERE
    > end if
    >
    > if strURL <> "" then
    > response.redirect(strURL)
    > end if
    >
    >
    > redirect.aspx code here:
    >
    > select case request.QueryString("page")
    >
    > case "stridx"
    > session("sname")= request.querystring("sname")
    >
    > response.Redirect("stridx.aspx")
    >
    > case "APIQ"
    > session("parcel") = request.QueryString("parcel")
    > session("year") = request.QueryString("year")
    >
    > response.Redirect("APIQ.aspx")
    > case "pdssub"
    > session("map") = request.QueryString("rmap")
    > session("plat") = request.QueryString("rplat")
    >
    > response.Redirect("pdssub.aspx")
    > case "dockm"
    > session("docket")= request.QueryString("docket")
    > session("page") = request.QueryString("page")
    >
    > response.Redirect("asrdockm.aspx")
    > case else
    > response.Write("WHAT THE CRAP!!?!?!??!")
    >
    > end select
    >
    > the case statement i am having problems with is the dockm statement
    > code skips over it and goes to the else statement
    > all the other case statements work great
    >
    > if i substitue dockm for APIQ in the URL string i get the same behavior
    >
    > this works:
    > strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
    > "&year=" & lbYear.text
    >
    > this doesnt:
    > strURL = "redirect.aspx?page=dockm&docket=" & tbSubDocket.text &
    > "&page=" & tbSubPage.text
    >
    > and modifying to this doesnt work either:
    > strURL = "redirect.aspx?page=APIQ&docket=" & tbSubDocket.text &
    > "&page=" & tbSubPage.text
    > (just changed page value to APIQ)
    >
    > goes straight to else statement
    >
    > Can anyone help with this?
    >
    > Thanks in advance
    >
     
    Bruce Barker, Sep 27, 2005
    #2
    1. Advertising

  3. Hi,
    it fails because you are using two variables of the same name "page" in the
    querystring which creates an array with two values: QueryString("page")(0)
    and QueryString("page")(1).
    Rename the other "page" (this -> page=" & tbSubPage.text) to something else
    and it will work.
    Cheers

    "" wrote:

    > Hello all,
    >
    > Have an issue where a redirect pushes data to a page with a select case
    > which then redirects to another page. Problem is the redirect isnt
    > working in 1 case. Code below:
    >
    > strURL = ""
    >
    > if i = 1 then
    > strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
    > "&year=" & lbYear.text
    > elseif i > 1 then
    > strURL = "redirect.aspx?page=dockm&docket=" & tbSubDocket.text &
    > "&page=" & tbSubPage.text <====== PROBLEM STARTS HERE
    > end if
    >
    > if strURL <> "" then
    > response.redirect(strURL)
    > end if
    >
    >
    > redirect.aspx code here:
    >
    > select case request.QueryString("page")
    >
    > case "stridx"
    > session("sname")= request.querystring("sname")
    >
    > response.Redirect("stridx.aspx")
    >
    > case "APIQ"
    > session("parcel") = request.QueryString("parcel")
    > session("year") = request.QueryString("year")
    >
    > response.Redirect("APIQ.aspx")
    > case "pdssub"
    > session("map") = request.QueryString("rmap")
    > session("plat") = request.QueryString("rplat")
    >
    > response.Redirect("pdssub.aspx")
    > case "dockm"
    > session("docket")= request.QueryString("docket")
    > session("page") = request.QueryString("page")
    >
    > response.Redirect("asrdockm.aspx")
    > case else
    > response.Write("WHAT THE CRAP!!?!?!??!")
    >
    > end select
    >
    > the case statement i am having problems with is the dockm statement
    > code skips over it and goes to the else statement
    > all the other case statements work great
    >
    > if i substitue dockm for APIQ in the URL string i get the same behavior
    >
    > this works:
    > strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
    > "&year=" & lbYear.text
    >
    > this doesnt:
    > strURL = "redirect.aspx?page=dockm&docket=" & tbSubDocket.text &
    > "&page=" & tbSubPage.text
    >
    > and modifying to this doesnt work either:
    > strURL = "redirect.aspx?page=APIQ&docket=" & tbSubDocket.text &
    > "&page=" & tbSubPage.text
    > (just changed page value to APIQ)
    >
    > goes straight to else statement
    >
    > Can anyone help with this?
    >
    > Thanks in advance
    >
    >
     
    =?Utf-8?B?YWxleDQ0NA==?=, Sep 27, 2005
    #3
  4. Guest

    LOL thanks.... I just noticed that when I got in this morning!!

    rookie mistake.

    thanks for the help
     
    , Sep 27, 2005
    #4
  5. Promaterial

    Joined:
    Jul 26, 2007
    Messages:
    1
    Question

    There is a form we use at work that was created by someone else. Right now everything is stored using query string so the values are stored in the URL to access accross multiple pages. Depending on how much information is in the URL, the page will crash, so they want me to change that and use session variables instead.

    I'm not very familiar with session variables and I was wondering what would be the easiest way to go about this, something that is fast and will be called in other pages about 500 times. Does anyone have any suggestions?

    Thanks,
     
    Promaterial, Jul 26, 2007
    #5
    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. Tee
    Replies:
    3
    Views:
    7,817
    Herfried K. Wagner [MVP]
    Jun 23, 2004
  2. Lakshmi Narayanan.R

    "Case 1 To 5" in Select case, giving Error!!. Why?

    Lakshmi Narayanan.R, Mar 2, 2005, in forum: ASP General
    Replies:
    10
    Views:
    354
    Bob Barrows [MVP]
    Mar 4, 2005
  3. aa
    Replies:
    14
    Views:
    330
  4. palmiere
    Replies:
    1
    Views:
    413
    Erwin Moller
    Feb 9, 2004
  5. BlackHelicopter
    Replies:
    0
    Views:
    528
    BlackHelicopter
    Jan 31, 2013
Loading...

Share This Page