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??
"Patrick Ruhnow" <pr*****@dornbracht.de> schrieb im Newsbeitrag
news:uM**************@TK2MSFTNGP11.phx.gbl...
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...
"Patrick Ruhnow" <pr*****@dornbracht.de> schrieb im Newsbeitrag
news:uA**************@TK2MSFTNGP09.phx.gbl... i solved the problem!
the KB article helped me:
http://support.microsoft.com/default...b;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
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> schrieb im
Newsbeitrag news:Oz*************@TK2MSFTNGP10.phx.gbl... 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
"Patrick Ruhnow" <pr*****@dornbracht.de> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
> 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
>
>
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com>
schrieb im > Newsbeitrag news:uY**************@tk2msftngp13.phx.gbl...
>> 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
>>
>> "Patrick Ruhnow" <pr*****@dornbracht.de> wrote in message
>> news:%2****************@tk2msftngp13.phx.gbl...
>> > 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
>> >
>> >
>>
>>
>
>