473,748 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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><hea d></head><body><for m 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 1549
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><hea d></head><body><for m 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.m icrosoft.com> wrote in message
news:6u******** ******@cpmsftng xa10.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
9560
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 the others just run these routines once. Any ideas!
14
13113
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) { //existing session? if (Session == null) { //save local empty order object this._newOrder = Orders.Initialize();
4
3990
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 was endeavoring to create a custom user control to make things a bit simpler, but she noticed that her Page_Load eventhandler was firing twice. So after long hours of research and experimentation, I stumbled upon, imho, is quite the discovery. ...
1
1573
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 also have a page_load event on all of the other pages. I am finding however that the page_load event on the template page is being fired twice.
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9370
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.