Response.Redirect to Page Anchored default.asp

Results 1 to 3 of 3

Thread: Response.Redirect to Page Anchored default.asp

  1. #1
    Join Date
    Dec 1969

    Default Response.Redirect to Page Anchored default.asp

    After the user submits a form and my asp script posts some info to the database, I want the user to see a page anchor:<BR><BR>*********************************** ***************<BR>response.redirect "default.asp?ID=&#060;%=strID%&#062;#Info"<BR>**** **********************************************<BR> <BR>But this doesn&#039;t work. How do your redirect to a page anchor?<BR><BR>Another big problem I&#039;m having is that all the different pages in my application have the exact same url, but show different content based on what the user clicks on. I tried to do the redirect using Java Script, but the browser wouldn&#039;t reload my page; it returned a blank page cause it thought the page anchor was on the asp page I used to add the record to the database.<BR>************************************* *************<BR>Sub JavaRedirect (strURL)<BR> &#039;Response.Write "redirect to:" & strRedirect<BR> %&#062;<BR> &#060;SCRIPT language="JavaScript"&#062;<BR>&#060;!--<BR> window.location.href = <BR> &#039;&#060;%=strRedirect%&#062;&#039;;<BR>//--&#062;<BR><BR> &#060;/SCRIPT&#062;<BR> &#060;%<BR> End Sub<BR>strRedirect = "default.asp?ID=&#060;%=strID%&#062;#Info"<BR>Java Redirect(strRedirect)<BR>************************* *************************<BR><BR>I would appreciate any advice on how to organize applications. Should I use a lot of different files, or try to get everything to work from default.asp?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Response.Redirect to Page Anchored default.asp

    To get around the anchor problem I use this code at the top of the page<BR><BR>MyId = Request.QueryString("MyId")<BR>If Instr(MyId,"#") &#062; 0 then<BR> MyId = Left(MyId,Instr(MyId,"#")-1)<BR>End if<BR><BR>You are making your life far too complicated by using one page to do everything. It will also have a performance impact as the page has to do lots of processing to find out what needs to be displayed. Unless there is a very good reason for doing it all on the same page, I would split it into logical areas of functionality.

  3. #3
    Andres C. Guest

    Default RE: Response.Redirect to Page Anchored default.asp

    Your problem is in the way you are constructing the redirect string. Compare these two...<BR>Yours:<BR>response.redirect "default.asp?ID=&#060;%=strID%&#062;#Info"<BR><BR> Correct:<BR>response.redirect "default.asp?ID=" & strID & "#Info"<BR><BR>If, in a VBScript block of code you add &#060;%=...%&#062; inside a string, it does not get processed. You will have exactly what you see on your string, which doesn&#039;t work. You are having the same problem in the JavaScript part, when you declare strRedirect.<BR><BR>I don&#039;t particularly like the approach of using a single page for everything, but it works in some situations.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts