Link to home
Start Free TrialLog in
Avatar of Overthere
Overthere

asked on

Extracting parameter from url - request querystring problem

Hello folks,

   I have created a simple aspx page in which I pass a parameter to it from another page (id) that I wish to extract and then display the right image etc.
However, it is always defaulting to the case else statment and the var catid is blank when I display it. I t is being passed correctly by the preceding page.
What am I doing wrong?




<!DOCTYPE HTML >
<html lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"  >
<link href="css/gallerypg.css" rel="stylesheet" type="text/css">

<script type=text/javascript>

    function md(e) {
        try { if (event.button == 2 || event.button == 3) return false; }
        catch (e) { if (e.which == 3) return false; }
    }
    document.oncontextmenu = function () { return false; }
    document.ondragstart = function () { return false; }
    document.onmousedown = md;
 
 </script>
<%
    Dim vpic As String
    Dim vpage As String
 
    Dim catid = Request.QueryString("id")
   
    Response.Write("catid") 'display the value passed

    Select Case "catid"
        Case "afrik"
            vpic = "images/largeafrikanique.jpg"
            vpage = "ppafrik.html"
        Case "alien"
            vpic = "images/largeaalien.jpg"
            vpage = "ppalien.html"
        Case "angelic"
            vpic = "images/largeangelic.jpg"
            vpage = "ppangel.html"
        Case "argonaut"
            vpic = "images/largeargonaut.jpg"
            vpage = "ppargo.html"
        Case "ascen"
            vpic = "images/largeascension.jpg"
            vpage = "ppascen.html"
        Case "azure"
            vpic = "images/largezure.jpg"
            vpage = "ppascen.html"
        Case "cave"
            vpic = "images/largecave.jpg"
            vpage = "ppcave.html"
        Case "emerge"
            vpic = "images/largeemerge.jpg"
            vpage = "ppemerge.html"
        Case "fire"
            vpic = "images/largefire.jpg"
            vpage = "ppfire.html"
        Case "flight"
            vpic = "images/largeflight.jpg"
            vpage = "ppflight.html"
        Case "gossamer"
            vpic = "images/largegrossamer.jpg"
            vpage = "ppgross.html"
        Case "jam"
            vpic = "images/largejam.jpg"
            vpage = "ppjam.html"
        Case "journey"
            vpic = "images/largejourney.jpg"
            vpage = "ppjourney.html"
        Case "martian"
            vpic = "images/largemartian.jpg"
            vpage = "ppmartian.html"
        Case "mess"
            vpic = "images/largemess.jpg"
            vpage = "ppmess.html"
        Case "phantom"
            vpic = "images/largephantom.jpg"
            vpage = "ppphantom.html"
        Case "phase"
            vpic = "images/largephase.jpg"
            vpage = "ppphase.html"
        Case "port"
            vpic = "images/largeport.jpg"
            vpage = "ppport.html"
        Case "reef"
            vpic = "images/largereef.jpg"
            vpage = "ppreef.html"
        Case "sun"
            vpic = "images/largesunship.jpg"
            vpage = "ppsun.html"
        Case "voyager"
            vpic = "images/largevoyager.jpg"
            vpage = "ppvoyager.html"
        Case "warp"
            vpic = "images/largewarp.jpg"
            vpage = "ppwarp.html"
        Case "watcher"
            vpic = "images/largewatcher.jpg"
            vpage = "ppwatcher.html"
        Case Else
            vpic = "images/largeafrikanique.jpg"
            vpage = "ppafrik.html"
    End Select
       
   
    %>
</head>
<body >
<img  class="galleryhdr" src="images/largeheader.jpg" width="955px" border=0  align="top" usemap="#Map2" alt="">
<img  class="gallerypic" src= <%=vpic%> width="955"  height="861" border=0 align="top"  alt="">
<map name="Map2">
  <area shape="rect" coords="23,37,107,72" href="default2.html"  title="HomePage" alt="Home Page">
  <area shape="rect" coords="124,35,198,66" href="aboutsel.html"  title="" alt="About Selywn Lissack">
  <area shape="rect" coords="222,32,418,68" href="premire.html"  title=" "alt="Premier Holograms">
  <area shape="rect" coords="448,36,596,69" href="pgsel1.html"  title=" "alt="Art Holograms">
  <area shape="rect" coords="624,36,725,72" href="digitalmain.html"   title=" "alt="Digital Art">
  <area shape="rect" coords="750,39,821,66" href="mainmusic.html"  title="Music" alt="Music">
  <area shape="rect" coords="836,35,959,65" href="contactus.html"  Title="Contact Us" alt="Contact Us">
  <area shape="rect" coords="751,217,958,272" href=<%=vpage %>   title="" alt="Buy Now">
  <area shape="rect" coords="29,204,214,249" href="digitalmain.html"  title="" alt="Gallery">
</map>
<center>
</center>
</body>
</html>
Avatar of Dale Burrell
Dale Burrell
Flag of New Zealand image

Can you post the exact URL you are using please.

Also consider putting your code in the Page_Load event as having it inline as you have might be calling it too early in the page processing chain.

Also check trace.axd to see if the parameter is being picked up by the trace.

PS - its not an ASP question - ASP & ASP.NET are very distinct technologies
Avatar of Overthere
Overthere

ASKER

oh! Here is web site consist of - all html pages (HTML 5) and this is going to be the only asp page. It will eliminate about 12 pages or so and that makes it easier to maintain. I thought I could just write it classical asp and go from there. The HTML pages were originally written in Dreamweaver 2003 - yes , I know old..old. And I updated with css html5 etc.
I have MS Visual Studio 2010 and since the Dreamweaver didn't like the asp page I thought well, I will just write in Visual Studio, test and go my merry way....LOL.
THe exact URl is not live but I can post the two pages to the live web site after 9 (MCT) tonight and then post the link for you. I will post and let you know when I have done so...
Sorry, just to clarify, is it an asp page or aspx page? They are completely different...

You said aspx in your question, but said asp in your reply.

I don't need to be able to access the URL, I just want you to post it (even if its the localhost URL) so I can check you have constructed it correctly.

Do try using trace.axd if the page is an aspx page as that will tell you a lot about whether its working or not.

And if it is an aspx page try using the Page_Load event.
Okay, I did write aspx when I meant asp.
I uploaded the pages, http://www.dalihologram.com/digitaltest.html
click on one of the images and it should take you to digitalpics,asp and dispaly a large view of the image - but the live server keeps giving me 500 internal error - boo!
On my local machine, it displays the page but no image. I included a response.write(variable name) and response.end  so I could see what the variable contained if anything and even tried to rearrange the coding on the page.
I do not want to do a .net page - its just a very simple page asp and although I have done the same thing many times before, I can not get it right.
Do you want me to post the new coding?
SOLUTION
Avatar of Dale Burrell
Dale Burrell
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ps - hiding the right click menu only pisses people off...
SOLUTION
Avatar of worthyking1
worthyking1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're welcome! Point split is fine with me :)
Both suggestions were very helpful in resolving the problems.