Simpe URL request for page

Discussion in 'C#' started by mnymkr, Apr 30, 2007.

  1. #1
    This works on one of my sites but not the other. I have no idea why.

    i have a page called rings.asp that has links that determine the next page

    ring-select.asp?type=Engagement

    However the page is not calling and i am getting an auto redirect ot my site map for some reason.

    those code work on one site for the above but not another site set up in the same way...... any push in the right direction would be helpful

    <!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.6 Library" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" VERSION="2.6"-->
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    
    <head>
        <link href="style.css" rel="stylesheet" type="text/css">
     
        <META Name="Keywords" Content="diamond, jewelry contact us, webmaster, feedback, chat">
        <META Name="Description" Content="Offer diamond jewelry contact information live chat help resource advice">
        <META Name="Robots" Content="index,follow">
        <META Name="Googlebot" Content="index,follow">
    </head>
    
    <!--#include virtual = "/adam/topnav.asp"-->
    
    <table border="0" cellspacing="3" cellpadding="3" background="images/background.gif" width="850" height="730">
    <tr>
    <td valign="top" align="left" width="10" class="secondary">
    &nbsp;<br>
    </td>
    <td valign="top" align="left" width="585" class="secondary">
    <h3>Select Your Ring</h3>
    
    <%
    gottype = Request.Querystring("type")
    pageNo = CInt(Request.QueryString("pNum"))
    gotmaterial = Request.Querystring("material")
    if gottype = "" then gottype = "Band" end if
    DatabaseNameStr = "jewelry.mdb"
    DatabaseLocationStr = Left(Request.ServerVariables("PATH_TRANSLATED"), InstrRev(Request.ServerVariables("PATH_TRANSLATED"), "\") )
    ConnectionStr = "DBQ=" & DatabaseLocationStr & DatabaseNameStr & ";DefaultDir=" & DatabaseLocationStr & ";Driver={Microsoft Access Driver (*.mdb)};"
    set Conn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.RecordSet")
    Conn.Open(ConnectionStr)
    SQL = "SELECT * FROM Jewelry WHERE Type = '" & gottype & "' ORDER BY Price ASC" 
    'response.end
    'rs.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
    rs.Open SQL, Conn, adOpenStatic, 3
    if pageNo = 0 then 
    pageNo = 1 
    end if
    on error resume next
    %>
    
    <% if rs.BOF and rs.EOF then %>
    &nbsp;<br>
    <p align="center" class="secondary">
    There was an error accessing our database, please try again later
    </p>
    <% 
    response.end
    end if 
    %>
    
    <%                          
        ' Set the page size to 10 records
        rs.PageSize = 16
        ' Move to the requested page
        rs.Move (pageNo - 1) * rs.PageSize
        ' Work out how many records are in this page
        If pageNo < rs.PageCount Then
            limit = rs.PageSize
        Else
            limit = rs.RecordCount - rs.PageCount * rs.PageSize + rs.PageSize
        End If
    %>
    
                        <br>
                      <table border="0" cellspacing="0" cellpadding="0" width="480">
                                <% if gottype = "Sets" then %>
                                <tr>
                                <td class="secondary" valign="top" colspan="2">All rings are available in 14K yellow or white gold, 18K gold or Platinum.<br>
                                 Simply click on the ring image to get more details on the ring.<p></td>
                                </tr>
                                <tr> 
                                <%
                                i = 0 
                                For x = 1 To limit
                                if i = 0 then
                                ' do nothing 
                                elseif (i/2 = Clng(i/2)) then 
                                %>
                                </tr>
                                <tr>
                                <% end if %>
                                <td class="secondary" valign="top" align="center" bgcolor="#C7CADD">
                                <a href="ringselect.asp?type=<%=gottype%>&id=<%=rs("ID")%>&material=<%=rs("description")%>"><img src="/images/rings/<%=rs("Style_Number")%>.jpg" border="0"></a>
                                <b><%=FormatNumber(rs("Carat"),2)%>CT Total Weight - Set Price: <%=FormatCurrency(rs("Price"),2)%></b>
                                <% if (i/2 = Clng(i/2)) then %>
                                </td>
                                <% end if %>
                                <%
                                i = i + 1
                                rs.movenext
                                next
                                %>
                                <p>
                                </td>
                                </tr>
                                <td  class="secondary" valign="top" align="left" bgcolor="#eeeeee">
    &nbsp; Page: 
    
    <%
        For y = 1 To rs.Pagecount
            If y <> pageNo Then
    %>
            <a href="ring-select.asp?pNum=<%=y%>&type=<%=gottype%>&material=<%=rs("description")%>"><%=y%></a>
    <% Else %>
            <%=y%>
    <% 
        End If
        Next            
    %>
                                </td>
                                <td  class="secondary" valign="top" align="right" bgcolor="#eeeeee">
                                <a href="ring-select.asp?pNum=1&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/firstpage.gif" border="0"></a>
                                <% If pageNo > 1 Then %>
                                <a href="ring-select.asp?pNum=<%=PageNo-1%>&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/prevpage.gif" border="0"></a>
                                <% End If %>
                                <% If pageNo < rs.PageCount Then %>
                                <a href="ring-select.asp?pNum=<%=PageNo+1%>&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/nextpage.gif" border="0"></a>
                                <% End If %>
                                <a href="ring-select.asp?pNum=<%=rs.PageCount%>&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/lastpage.gif" border="0"></a>
                            </td>
                            </tr>
                            </table>
                                <% else %>
                                <tr>
                                <td  class="secondary" valign="top" colspan="4" align="center">All rings are available in 14K yellow or white gold, 18K gold or Platinum.<br>
                                 Simply click on the ring image to get more details on the ring.<p></td>
                                </tr>
                                <tr> 
                                <%
                                i = 0 
                                For x = 1 To limit
                                if i = 0 then
                                ' do nothing 
                                elseif (i/4 = Clng(i/4)) then 
                                %>
                                </tr>
                                <tr>
                                <% end if %>
                                <td  class="secondary" valign="top" align="left" bgcolor="#C7CADD">
                                <a href="ring_details.asp?type=<%=gottype%>&id=<%=rs("ID")%>&material=<%=rs("description")%>"><img src="/images/rings/<%=rs("Style_Number")%>.jpg" border="0"></a>
                                <b>&nbsp; <%=rs("Carat")%>CT &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <%=FormatCurrency(rs("Price"),2)%></b>
                                <% if (i/4 = Clng(i/4)) then %>
                                </td>
                                <% end if %>
                                <%
                                i = i + 1
                                rs.movenext
                                next
                                %>
                                <p>
                                </td>
                                </tr>
                                <td  class="secondary" valign="top" align="left" colspan="2">
    &nbsp; Page: 
    
    <%
        For y = 1 To rs.Pagecount
            If y <> pageNo Then
    %>
            <a href="ring-select.asp?pNum=<%=y%>&type=<%=gottype%>&material=<%=rs("description")%>"><%=y%></a>
    <% Else %>
            <%=y%>
    <% 
        End If
        Next            
    %>
                                </td>
                                <td class="secondary" valign="top" align="right" colspan="2">
                                <a href="ring-select.asp?pNum=1&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/firstpage.gif" border="0"></a>
                                <% If pageNo > 1 Then %>
                                <a href="ring-select.asp?pNum=<%=PageNo-1%>&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/prevpage.gif" border="0"></a>
                                <% End If %>
                                <% If pageNo < rs.PageCount Then %>
                                <a href="ring-select.asp?pNum=<%=PageNo+1%>&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/nextpage.gif" border="0"></a>
                                <% End If %>
                                <a href="ring-select.asp?pNum=<%=rs.PageCount%>&type=<%=gottype%>&material=<%=rs("description")%>"><img src="/images/lastpage.gif" border="0"></a>
                                &nbsp;<br>
                            </td>
                            </tr>
                            </table>
                                <% end if %>
    </td>
    <% 
    set rs = nothing
    conn.close 
    %>
    <!--#include virtual="/adam/rightside.asp"-->
    <!--#include virtual="/adam/footer.asp"-->
    Code (markup):
     
    mnymkr, Apr 30, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    If it works on 1 site and not the other - maybe it's a pathing issue? (location of your access db is different maybe)?

    Please let us see it, or see the url :)
     
    ccoonen, May 1, 2007 IP
  3. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #3
    let em first say i know next to nothing about .asp

    the owner of the site opend a .asp file with code in NVU and it converted all of its tags to ASCII. He was trying to put on meta header files in

    I tried fixing the original file but no avail. Then I remember he had the exact same function on another site.

    http://www.adamaunt.com/rings.asp Click on "engagement rings"

    This is how it should act

    http://americas-diamonds.com

    this is the site that is messed up

    clicking on a similar link takes you to the site map

    http://americas-diamonds.com/rings.asp



    rings.asp is basically just a links page no real asp where the link takes you to .

    http://americas-diamonds.com/ring-select.asp?type=Engagement

    i have no idea why it is not calling the page.....
     
    mnymkr, May 1, 2007 IP
  4. WebGyver

    WebGyver Guest

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Looks like the pages might be mis-named on americas-diamonds.com.

    If I go straight to the page americas-diamonds.com/ring-select.asp?type=Engagement (by typing the URL into the address bar by hand), I get to what looks like the site map.

    So it doesn't look as though there's anything wrong with the ASP code per se. Instead, I would make sure that all the pages have the correct page names.

    Probably just one of those silly copy & paste issues.

    For what it's worth!
     
    WebGyver, May 1, 2007 IP
  5. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #5
    I checked that.

    site map is name sitemap.asp

    and the page is named

    ring-select.asp


    that is what is confusing me

    and the links point correctly to rind-select.asp
     
    mnymkr, May 1, 2007 IP
  6. WebGyver

    WebGyver Guest

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes, the page names are correct, but it looks as though somehow the content from the sitemap.asp is now inside the ring-select.asp page -- you seem to have two identical pages.

    If I type in: americas-diamonds.com/sitemap.asp

    I get the same page as when I type in: americas-diamonds.com/ring-select.asp

    Somehow there are two identical pages with two different file names.
     
    WebGyver, May 1, 2007 IP
  7. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #7
    i assure you the pages are both very different.......the one above at the top of the post is the ring-select.asp

    you will note there is no code for the site map
     
    mnymkr, May 1, 2007 IP