select case not working

M

mark.irwin

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
 
B

Bruce Barker

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
 
G

Guest

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
 
M

mark.irwin

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

rookie mistake.

thanks for the help
 
Joined
Jul 26, 2007
Messages
1
Reaction score
0
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,
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top