Page_Load being fired twice

G

Guest

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
 
N

Nimrod cohen

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 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 introduced
 
S

Steven Cheng[MSFT]

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
 
M

Mothish K

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
 
S

Steven Cheng[MSFT]

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
 
S

Steven Cheng[MSFT]

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
 
N

Nimrod Cohen

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!
 
S

Steven Cheng[MSFT]

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
 

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,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top