ASP Page on IIS is loaded twice

P

Patrick Ruhnow

Hello,

i have an ASP Page that generates a PDF document.
After the generation i save the generated document as a file.
all works fine.

the only strange thing is, that my document is stored twice on the
filesystem.

why is the page loaded twice???


regards
Patrick
 
R

Ray at

How is the file stored twice? You can't have two files with the same name
in the same directory, so how do you know that your page is running twice?

Ray at home
 
P

Patrick Ruhnow

Because we archiving this document, i'll create a filename like
docname_user_time_seconds.pdf
The stream of the document will be created in a COM component.

That's why i know ... :)

Patrick @work
 
R

Ray at

Okay, we'd need to see some relevant code snippets then or get more info.
Are you calling a method twice? Are your users refreshing the page causing
the action to happen twice? Etc.

Ray at work
 
P

Patrick Ruhnow

i solved the problem!
the KB article helped me:
http://support.microsoft.com/default.aspx?scid=kb;en-us;293792

it's how the ie gets the information to open the pdf-plugin...
here my code that solves the problem:

Response.Clear();
Response.Expires = 0;
Response.Buffer = false;

// First call ??
if(Request.ServerVariables("HTTP_USER_AGENT").Item == "contype")
{
// setting the contenttype to PDF
Response.ContentType = "application/pdf";
}
else
{
// if reach here, the "second" call was made
// place the pdf-creating/storing here
// the Request.ServerVariables("HTTP_USER_AGENT").Item value is now
like:
// "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
1.0.3705; .NET CLR 1.1.4322)"

}

regards
Patrick
 
P

Patrick Ruhnow

i've been glad too early.. it work not...
i think it was a cache problem that it works before... :(

any solutions??

my page does the following:
1. set the ContentType to "application/pdf"
2. get my pdf stream out of a component.
3. writing the stream with binaryWrite on the page.

the component saves "once" the document on filesystem.

i saw many topics that the iis get 2 requests...
 
P

Patrick Ruhnow

Hello...

after hard testing i have the following solution:

Response.Clear();
Response.Expires = 1;
Response.Buffer = false;

var d = new Date();

// Erster Aufruf??
if(Request.ServerVariables("HTTP_USER_AGENT").Item == "contype")
{
Response.ContentType = "application/pdf";
}
else
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline;filename=stream" +
Session.SessionID + d.getMilliseconds() + ".pdf");
}

this snippet works..
i found out, that "my" problem was depending on the Expires Property.. it
must have a value > 0. otherwise
he makes two requests of the same USER_AGENT type.

It's not very satisfying, not to know why there is such a behaviour.
perhaps someone knows??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top