473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ASP Page on IIS is loaded twice

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
Jul 19 '05 #1
7 2693
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

Jul 19 '05 #2
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


Jul 19 '05 #3
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
>
>



Jul 19 '05 #4
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
>
>



Jul 19 '05 #5

"Patrick Ruhnow" <pr*****@dornbracht.de> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl...
i solved the problem!
the KB article helped me:
http://support.microsoft.com/default...b;en-us;293792


Interesting article, thanks!

Ray at work
Jul 19 '05 #6
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
> >
> >
>
>



Jul 19 '05 #7
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
>> >
>> >
>>
>>
>
>



Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim | last post by:
I have dropdown list in Login page. The data is adding twice because the Page_Load event is executing twice. But I am checking !Page.IsPostBack property. First time the value for '!Page.IsPostBack'...
2
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
5
by: Tim | last post by:
I have block of code adding values to dropdown list under if (!Page.IsPostBack) { adding items } else { refreshing data }
1
by: Tim | last post by:
I have dropdown list in Login page. The data is adding twice because the Page_Load event is executing twice. But I am checking !Page.IsPostBack property. First time the value for '!Page.IsPostBack'...
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
5
by: Asa Monsey | last post by:
I am having a problem that the page load event fires twice in reponse to an autopostback. The first time, the IsPostBack property is true, and the second time it it false. This is causing many...
2
by: hemant.singh | last post by:
I am stuck with strange JS issue My product gives user to show some images(which track mouseover) on page by embedding script like <script src=http://domain.com/GetDynamicJS?domagic=1>...
2
by: =?Utf-8?B?VG9tw6FzIE1hcnTDrW5leg==?= | last post by:
Hi, I recently converted an ASP.NET project for framework 2.0. I never had any problem using VS 2003 but today, debugging a page, I get surprised when I saw that once debugged the last line, it...
22
by: Christopher Nelson | last post by:
I have a little menu system which essentially takes HTML like: <div id='foo'></div> and retrieves foo.shtml from the server and inserts it inside the <div>. But sometimes I'd like foo.shtml...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.