473,387 Members | 1,673 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,387 software developers and data experts.

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 1528
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Andy | last post by:
Visual Studio 2003 web form problem using C#. My Page_Load or OnInit routines seems to be called twice for every post back to the server. I have 2 web forms that produce this behaviour, all of...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
1
by: Rippo | last post by:
Hi I have a Master page that opens up a db connection, performs a couple of global routines in the page_load event. All of my other web pages in my web app then inherits this Master Page I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.