Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL in IE Address Box doesn't get updated

Status
Not open for further replies.

apple17

Programmer
Jul 5, 2005
46
US
I have a couple web pages where a user can generate a file extract from the database. Basically, I get the data and format it via 'reponse.write' commands, then perform the code below. This generates a file that the user can open or download. HOWEVER, from that point on, the URL in the address box doesn't change when you move on to other pages. Everything works fine, but you need to enter a new URL for the address box to start reflecting the page you are on. Can someone tell me why this happens (and how to correct)?

THANKS!!!

'declare our variables
Dim objFSO , myFile
'create an instance of the FileSystemObject
'Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
filename = Server.MapPath("access/mailing.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'create a text file called mytestfile.txt
Set myFile = objFSO.CreateTextFile(filename, True)
'write a couple of lines of text in the file
myFile.WriteLine("")
myFile.Close
'destroy the object
Set myFile = Nothing
Set objFSO = Nothing

set fs=server.CreateObject("scripting.filesystemobject")

set objfile=fs.GetFile(filename)
size=objfile.size
fname=objfile.name
mime_type="application/save-as"
Response.AddHeader "Expires:",0
Response.ContentType=mime_type
Response.AddHeader "Content-Disposition","attachment; filename="&fname
set objStream =server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type=1
objStream.LoadFromFile filename
Response.BinaryWrite objStream.Read

Response.end
 
I can't provide a link, it's got security on it.

It does not use frames, but that's what it's acting like, in that the URL never changes.
 
That doesn't help, and causes other problems.
 
I am just guessing but try closing out fs and objfile.
You create them but do not close them out afterward (at least in your posted code) so perhaps the browser is still trying to operate in the context of the filesystemobject?


Paranoid? ME?? WHO WANTS TO KNOW????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top