470,614 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

Page_Load being fired twice

Hi

During the page_load of my Aspx page "http://myMachine/MyWebApp/Quote.aspx" , i write to the response an html that embeds a form with the action pointing out to the same aspx page
i.e
Response.Write( "<html><head></head><body><form action="http://myMachine/MyWebApp/Quote.aspx" name="QuoteForm" method="POST"><input type="hidden" name="response_supplier_id" value="13"/
...
</form></body></html>" )

what happens is that my page_load function is being fired twice, once with all the parameters in the Request.Form arriving as expected ( the first occurance is a POST call ), the second time i get an unwanted "GET" call with no parameters in the Request.Form

I've checked and verified that the AutoEventWireup=false, and no event handler duplication has been introduce

could anyone point out of this mess
Nov 18 '05 #1
7 1438
Some points worth mentioning :
1. the project itself is a webservice containing some
webpages, amogst which, the aforementioned problematic
page.
2. this occurs when i'm initiating the process from an
html which is embedded inside an e-mail item, from an
outlook client. I have no way to test it from an http
based client, since the server is internal, so i can't
pass the link.

thanks.
-----Original Message-----
Hi,

During the page_load of my Aspx page "http://myMachine/MyWebApp/Quote.aspx" , i write to
the response an html that embeds a form with the action
pointing out to the same aspx pagei.e
Response.Write( "<html><head></head><body><form action="http://myMachine/MyWebApp/Quote.aspx"
name="QuoteForm" method="POST"><input type="hidden"
name="response_supplier_id" value="13"/>....
</form></body></html>" );

what happens is that my page_load function is being fired twice, once with all the parameters in the
Request.Form arriving as expected ( the first occurance
is a POST call ), the second time i get an unwanted "GET"
call with no parameters in the Request.Form.
I've checked and verified that the AutoEventWireup=false, and no event handler duplication
has been introduced
could anyone point out of this mess ?

.

Nov 18 '05 #2
Hi Nimrod,

From your description , you found one of your asp.net be loaded twice ( the
page_load event be entered twice). Also, the second loading of the page is
requested via "get" method , yes?

After your second message, I'm abit confused on your detailed situation.
But I recommend that you first isolate the web page which has the problem
and put it into a ASP.NET web application to test rather than in a
WebService Applicatoin. Also, as you mentioned that "you intial the process
from a html embeded in a email, then what about the result if we simply
request the asp.net page in browser directly?

So simply speaking, we can first create a simple test web project and put
the problem page in it test trough browser to see whether the problem can
be repro. If this still can repro it, I suggest that you provide some
detailed info on the page 's code( especially what does it render out , or
the client html source). I've ever met a similiar issue which is caused
that the page is referenced by it self in the output . For example, in the
page 's ourput, it contains a image element like

<img src="self url" >
Then when the browser processing this element, it'll use get method to
request the certain resource, please have a check on the above things. IF
you have anything unclear or any other new findings, please feel free to
post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


Nov 18 '05 #3
Hi Steven,

I have a aspx page with five web user controls.
The Scenario is like this,
I get the details from the page 1(pg_entry.aspx) and server.transfer to page
2(pg_login.aspx).
Page 2 shows authentication and once submits,
which inserts some value in db.
this insertion is getting twice, coz of page_load being fired twice.
what could be the problem.

thanks in advace..

Mothish K

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:6u**************@cpmsftngxa10.phx.gbl...
Hi Nimrod,

From your description , you found one of your asp.net be loaded twice ( the page_load event be entered twice). Also, the second loading of the page is
requested via "get" method , yes?

After your second message, I'm abit confused on your detailed situation.
But I recommend that you first isolate the web page which has the problem
and put it into a ASP.NET web application to test rather than in a
WebService Applicatoin. Also, as you mentioned that "you intial the process from a html embeded in a email, then what about the result if we simply
request the asp.net page in browser directly?

So simply speaking, we can first create a simple test web project and put
the problem page in it test trough browser to see whether the problem can
be repro. If this still can repro it, I suggest that you provide some
detailed info on the page 's code( especially what does it render out , or
the client html source). I've ever met a similiar issue which is caused
that the page is referenced by it self in the output . For example, in the
page 's ourput, it contains a image element like

<img src="self url" >
Then when the browser processing this element, it'll use get method to
request the certain resource, please have a check on the above things. IF
you have anything unclear or any other new findings, please feel free to
post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #4
Hi Nimrod,

Why are you using Response.Write to dynamically render the Page content,
especially the <form action="self url">, sine the ASP.NET's webform is by
design support post back to self. Can you replace the Response.Write's
output with a static aspx page template and see whether this will work? Or
try replacing the output content with some other simple html code, as
simple as possbile. IF the problem not occur, I think you can check the
long html source( use binary search to see whehter there is any element
cause the problem.)
Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #5
Hi Nimrod,,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #6

Hi steven,

I cannot implement your offer, because effectivly i'm generating the
html from an html templated ( selected from a database ) and install
into it live data.
and hance i cant use a pre-created ASPX file.

further more, i have already tried to use a simple html, and the problem
indeed, doesn't repro. but the html seems valid and i see no reason for
this weird behaviour.

thanks,

Nimrod.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7
Hi Nimrod,

Thanks. for your followup. Currently I also haven't any good suggestions on
this. But I think you can consider using some net monitor tools to have a
track on the http messages to see what ever the second request from if you
still feel no idea on this issue. How do you think of this? If you have any
further concerns or ideas , please also feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.