Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2012, 08:24 AM
Registered User
 
Join Date: Jun 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Is there a way to 'reset' the Response.ContentType and Headers?

My client wants to extract records by country from an Excel spreadsheet.
So I have one script which reloads itself twice :-
phase 1. display initial form, user selects country and Submits,
form action reloads itself with querystring '...?Extract=YES'

phase 2. Extract=YES
the extract code contains the following
Response.Buffer = true
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=Extract_List_" &myCountry &".xls"
...
...
Response.Flush
and stores a record count/message in session variables
now somehow reload script with querystring '...?Extract=DONE'

phase 3. Extract=DONE
display record count/message in session variables using Response.write

The actual extract works fine, creates the Excel file, but then stops/hangs ??
It doesn't reload and perform phase 3.

From 100s tests and various answers via Google, I've gathered that it's the RESPONSE method that I'm not understanding or using correctly. I've tried :
Response.Redirect ("scriptname?Extract=DONE")
Response.AddHeader "Refresh", "0;URL=scriptname?Extract=DONE"
Server.Transfer doesn't accept the ?Extract=DONE
even a javascript window.location.replace("scriptname?Extract=DONE") and
window.location.href = "scriptname?Extract=DONE"
but nothing happens

Is there a way to 'reset' the Response.ContentType and Headers?, so I can Response.write my record count/message ??

Can anyone dig me out of this hole ??
Thanks in advance





Similar Threads
Thread Thread Starter Forum Replies Last Post
change node contentType paultman BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 0 November 29th, 2005 01:06 PM
Problem with Response.ContentType nagesh_vasa XML 1 May 23rd, 2004 01:41 PM
<%Response.ContentType...Error Dayzed XML 3 April 14th, 2004 10:32 AM
Help with excel using response.contenttype YoungLuke Classic ASP Basics 0 October 2nd, 2003 11:16 AM
Response.ContentType jcsierra ASP.NET 1.x and 2.0 Application Design 0 September 8th, 2003 11:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.