response.redirect problem

Results 1 to 3 of 3

Thread: response.redirect problem

  1. #1
    gRUB Guest

    Default response.redirect problem

    I have a recursive function called getnewest which browses a specified directory and returns the newest file by the File.DateCreated property. Then it redirects top that file. It works great on two of 3 IIS&#039s but not on the third. I am trying to have it redirect to a pdf. I have right before the redirect this line:<BR><BR>response.contenttype=application/pdf<BR><BR>this error occurs on the one server:<BR>400 Bad Request<BR>Due to malformed syntax, the request could not be understood by the server. The client should not repeat the request without modifications.<BR><BR>im starting to think it might ba an adobe specific error? I tried puting some different pdfs int the folder being searched and now i get just a blank window without errors. Its going to the page but coming up blank. If you press enter in the address bar where the correct path is displayed, the pdf doc comes up fine.<BR><BR>Very unusual and I hope my explanation was clear :) Any thoughts?<BR><BR>Thanks<BR><BR>Dave

  2. #2
    jason Guest

    Default RE: response.redirect problem

    don&#039t change the content type. what you do when you response.redirect is this :<BR><BR>you send a 302 object moved response to the browser<BR>the browser then requests another page<BR>the server then sends the page<BR><BR>so you can&#039t give an application/pdf mimetype to the 302 - hence your error message<BR><BR>jason<BR><BR>

  3. #3
    Scouter Guest

    Default RE: response.redirect problem

    I also have a problem with the response.redirect of a PDF file, as Adobe is not supporting this. Adobe&#039s solution is to use Netscape or display the list of files on a screen and then have the user click the latest file. Duh, I don&#039t want that. I want the user to select the report name, have the ASP page search a directory, and then automatically redirect to the same window without user intervention.<BR><BR>Using VBScript, I get the vpath like this with an input filename picked from the user:<BR> <BR>set objQuery = Server.CreateObject("ixsso.Query")<BR>set objUtility = Server.CreateObject("ixsso.Util")<BR><BR>objQuery. Catalog = "D:IISIndexServerDefaultSite"<BR>objQuery.Quer y = "#FileName " & SearchString & "*.pdf"<BR>objQuery.SortBy = "write[d]"<BR>objQuery.Columns = "vpath, filename, write"<BR>objQuery.LocaleID = objUtility.ISOToLocaleID(SiteLocale)<BR>objUtility .AddScopeToQuery objQuery, FormScope, "deep"<BR> <BR>set RS = objQuery.CreateRecordSet("nonsequential")<BR>RS.Pa geSize = PageSize<BR>ActiveQuery = TRUE <BR>if not RS.EOF then <BR> RS.MoveFirst<BR> txtUrl = Trim(RS("vpath"))<BR> Response.ContentType = "application/pdf"<BR> Response.Buffer = "True"<BR> Response.Redirect(txtUrl)<BR>end if<BR><BR>This, of course leads to the correct PDF file being displayed in the address line, but a blank page on the screen, because IE cannot read the PDF HTTP header on a redirect.<BR><BR>So, I have taken out the Response.Redirect statement, and I am now trying to use a hidden form on my page that will be submitted by JavaScript like so:<BR> In the body, I display messages for file not found, or launch the Javascript on successful find<BR><BR>&#060;% if RS.EOF then %&#062;<BR> &#060;hr&#062;<BR>&#060;center&#062;<BR> &#060;% if NextRecordNumber = 1 then %&#062;<BR> &#060;b&#062;There are no versions of this report currently on the web site.&#060;/b&#062;<BR> &#060;% else %&#062;<BR> &#060;b&#062;No more reports found.&#060;/b&#062;<BR> &#060;% end if %&#062;<BR> &#060;/center&#062;<BR> <BR>&#060;hr&#062;<BR>&#060;% else %&#062;<BR> &#060;script language="JavaScript"&#062; loadwindow();&#060;/script&#062;<BR>&#060;% end if %&#062;<BR><BR>In the heading, I have my Javascript:<BR>&#060;script ID="clientEventHandlersJS" LANGUAGE="javascript"&#062;<BR>function loadWindow()<BR>{<BR> document.frmLatest.submit();<BR> return;<BR>}<BR>&#060;/script&#062;<BR><BR>And at the end of the document, I have my Form:<BR>&#060;%&#039 Launch Latest Report %&#062;<BR>&#060;form action="&#060;%= txtUrl %&#062;" method="get" target="_self" id="frmLatest" name="frmLatest" style="z-index:-2; visibility:hidden; display:none;"&#062;<BR>&#060;/form&#062;<BR><BR><BR>I thought this would work, but unfortunately it does not.<BR>At this time, I am going to try adding in a select and option, nad I will let you know how it develops.<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