response.redirect- problem in asp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • new214
    New Member
    • Dec 2006
    • 11

    response.redirect- problem in asp

    heya all, ive got abit of a problem. Im doin a system in asp- which works on a test server- but when on moving my application to a development server- it throws the following error messages where I do Response.Redire ct:
    //messages begin----------------------------
    Response object error 'ASP 0156:80004005'
    Header Error
    /Catloguesearch2 .asp, line 18
    The HTTP headers are already written to the client
    browser. Any HTTP header modifications must be made before
    writing page content.
    //messages end------------------------------

    Ive already looked at the same post on this site- which coincidentally has the same problem but ive tried the soltion of looking at my include file as well as the set up on the other server.

    This is urgent, so any help will be very much appreciated.

    Thanks
  • nedu
    New Member
    • Nov 2006
    • 65

    #2
    Hi Frnd,

    Plz send the coding then only we can solve it ...



    Regards

    (M. Nedu . . .)

    Comment

    • new214
      New Member
      • Dec 2006
      • 11

      #3
      response.redire ct- problem in asp

      well- ive got a search page- which consits of a text box and a submit button- in a formwhich posts whatevers in the text box to this catalogue search.asp page.

      starting from my catalgoue page-


      Code:
      <%@ language = "vbscript" %>
      <% option explicit %>
      <!-- Catalogue-->
      
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
      <%    
        'This will be used for the page title and Header.
        pageName = "Catalogue Results"    
          
        'Variables
        dim CatCode, val1
        CatCode = request("Catalogue Code") 
        
        If( CatCode = "" ) Then
        response.redirect("Error page.asp")   'Please enter a value before clicking submit!
        Else
        End If 
      %>
      
      <body>
      <!--#include file="Header.asp"-->
      <tr><td>&nbsp;</td></tr>

      Please note ive only inclueded the part of the code where the error is pointing to.



      the header code is- which im including in the catalogue code is:

      Code:
      <head>
      <%
        dim folderDepth, backUrl, pageName
        'example: folderDepth = "../../../"
        folderDepth = "../../"
       
        'example: backUrl = "index.asp"
        backUrl = "template.asp"
          
        'We use session variables to hold the username and clearance when a member/ Member/ staffMember login.
        dim Username, Clearance, External
        Username = session("Username")
        Clearance = session("Clearance") 
        External  = session("sess_usertype") 
      
        If Username <> "" Then
      %>
      
      <title> NMBS: <%= pageName%> </title>
      <link rel="Stylesheet" type="text/css" href="<%= folderDepth%>CSS/ButtonStyles-BIDS.CSS" />
      <link rel="Stylesheet" type="text/css" href="<%= folderDepth%>CSS/whiteText-BIDS.CSS" />
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      
      <script type=text/javascript>
      var adImg = 0; // used to index the array
      var adURL = 1; // used to index the array
      var ad = new Array();
      var adOn = 0; // which ad is displayed currently
      function addImage(_i,_u) {
        ad[ad.length?ad.length:0] = new Array();
        ad[ad.length-1][adImg] = _i;
        ad[ad.length-1][adURL] = _u;
      }
      if (document.images) {
      addImage("nmbs2.bmp");
      addImage("mechanics.jpg");
      
      } 
      
      function cycleAds() { 
        if (document.images && document.adBanner.complete) { 
           adOn = ++adOn % ad.length;
           document.images.adBanner.src = ad[adOn][adImg]; 
        } 
      }
      var delay = 2.5; // time in seconds to delay between ads.
      var adTimer = null;
      adTimer = setInterval("cycleAds()",delay*1000);
      function gotoAd() { 
      document.location.href = ad[adOn][adURL];
      }
      function showStatus() {
        status = "GoTo: "+ad[adOn][adURL];
      }
      </script>
      </head>
      
      <table border="3" cellpadding = "2" cellspacing="2" width="100%" bgColor="#3380b2">
       	<tr>
      	  <th><h1><font color="white"><%= pageName%></font></h1></th> 
                <td align="left"><img src ="pda.jpg" width="150" height="100"></td>
      	  <td><a href='javascript:gotoAd()' onmouseout='status=""' onmouseover='showStatus();return true;'>
      	  <img border=0 alt='' name=adBanner src='nmbs2.bmp' width="310" height="85"></a></td>
       	</tr>
      </table>



      and im also including a footer file-which again is a simple message on the bottom of the page.


      ive checked all my include files and the code within them- but cannot seem to find the problem. Any suggestions or coding would be helpful thanks
      Last edited by new214; Dec 4 '06, 11:42 AM. Reason: mistake

      Comment

      • scripto
        New Member
        • Oct 2006
        • 143

        #4
        here you go

        Resolution

        add the following after the line <% Option Explicit %>:

        <% Response.Buffer = True %>

        Comment

        Working...