hyperlink to text file problem (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


dprice_2000 -> hyperlink to text file problem (4/18/2008 9:01:32)

Hi All,

I'm having problems with a hyperlink to a text file.
Here is the low-down...

A user selects a file from their drive and runs a process to parse and insert records into a database. This process can be repeated for any number of files.

During the process, if any errors are found, an error file is created and the offending record(s) are written to it. This file is used for all imports and is always deleted prior to importing. A hyperlink on the page points to the error file so the user can view the errors in notepad, correct them, save the file and reimport them.

The problem is that clicking on the link always brings up the first instance of the error file. "error[1].log"
It's as if it's being cached somewhere. It works on my local pc where I am developing from but not on the server where it lives.

Any ideas?

VS.NET

Thanks,




rdouglass -> RE: hyperlink to text file problem (4/18/2008 9:16:10)

Hi and Welcome to OutFront.

You say VS.NET? Local application or is it a Web App?

How are you creating the text file? Is it being created by the app each time?

Have you tried .NET no cache header like this?

<% System.Web.HttpContext.Current.Response.AddHeader( "Cache-Control","no-cache")
System.Web.HttpContext.Current.Response.Expires = 0
System.Web.HttpContext.Current.Response.Cache.SetN oStore()
System.Web.HttpContext.Current.Response.AddHeader( "Pragma", "no-cache")%>


That help any?




dprice_2000 -> RE: hyperlink to text file problem (4/18/2008 9:54:41)

Hi Mr. Douglass,

Yes, I'm developing using VS.NET 2005.
I develop it locally and then copy it up to the server.
It works fine on my pc but not on the server
I'm using a streamwriter to append the error record during the import.
I delete the error file prior to every import.

The lines you provided didn't have any affect.

thanks,
Dave




rdouglass -> RE: hyperlink to text file problem (4/18/2008 10:09:43)

quote:

I'm using a streamwriter to append the error record during the import.


So you delete it first and then recreate it? Or you append to the existing file?

That is a weird one. Do you always get the same file or is it always from the previous upload or error? IOW is it the same file every time? Does hitting refresh or clearing the local browser cache make any diff?




rdouglass -> RE: hyperlink to text file problem (4/18/2008 10:10:37)

quote:

Mr. Douglass,


Oh yeah, that's my father. [:D]




dprice_2000 -> RE: hyperlink to text file problem (4/18/2008 11:26:36)

Yes, I delete it and recreate it for each import.
As I process the import file I append the errors to the same file.

Yes it's weird. I've not run into this before.
I retested it. It's always the first one no matter how many imports I do.
Hitting refresh has no effect.

Deleting temporary files through the options menu does cause the correct file to show up!
From my reading I understand this is not easily done in code if not impossible.

thanks,
Dave




rdouglass -> RE: hyperlink to text file problem (4/18/2008 12:03:43)

So the link is directly to the text file?

If so, how about reading the text file into a stream on an ASPX page instead and then pushing it as a download file instead of a direct link to the text file. Then you're taking the user's browser preference right out of the picture by using the no-cache stuff.

Did that make any sense?




dprice_2000 -> RE: hyperlink to text file problem (4/18/2008 12:21:21)

That works for me. Thanks!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.109375