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

page_load is ignored / asp.net 2.0

Hi,

I am stucked in the following problem: I am using some Ajax
(javascript) code and I call via xmlhttprequest an aspx File. In the
code-behind aspx.vb file, I am creating an XML and want to send it
back.

Now, as soon as I remove all the html-tags (because I don't need it
for xml) in the aspx file (except the first line e.g. "<%@ Page
Language="VB" AutoEventWireup="true" CodeFile="some_main.aspx.vb"
Inherits="_some_main" %>") the page_load event will be ignored.

E.g. When I set the debugger breakpoint to the line "public writer as
xmlwriter = nothing" (see code below) and press f11 (next step) during
debugging, the program jumps to the next free line after "End Class",
and simply ignores the page_load.
------------------------------------------
Imports System.Web
Imports System.Xml
Imports System.Xml.Serialization
Imports System.Net
Imports System.IO
Imports Microsoft.VisualBasic

Partial Class _some_main
Inherits System.Web.UI.Page

Public Writer As XmlWriter = Nothing

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
[.... and so on ...]
------------------------------------------

I've tried some coding with "AddHandler Page.Load, AddressOf
Page_Load" within the added function "Private Function
InitializeComponent()", but I didn't suceed.

Thanks for you help.

Best regards,

Norbert

Feb 2 '07 #1
2 1065
Hi,

NorbertH wrote:
Hi,

I am stucked in the following problem: I am using some Ajax
(javascript) code and I call via xmlhttprequest an aspx File. In the
code-behind aspx.vb file, I am creating an XML and want to send it
back.

Now, as soon as I remove all the html-tags (because I don't need it
for xml) in the aspx file (except the first line e.g. "<%@ Page
Language="VB" AutoEventWireup="true" CodeFile="some_main.aspx.vb"
Inherits="_some_main" %>") the page_load event will be ignored.
I believe that you must at least have a FORM tag wth runat=server for
the page to be considered valid ASPX. If you remove everything including
the FORM tag, then I don't think that event wiring will work. I might be
wrong though (though your experience seems to prove me right).

If you don't need any HTML tags in your code, and you do every request
using AJAX, then you shouldn't use a Page anyway. Your website will be
much more efficient if you use an ASHX custom HTTP handler instead, for
example, because you will not fire all the events that a Page does, and
which you don't need anyway.

See any example of ASHX here:
http://www.galasoft-lb.ch/mydotnet/a...006100601.aspx

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Feb 3 '07 #2
Hi Laurent,

That was exactly what I was looking for! I did rewrite the code now,
this time by using an ashx file, and it's running perfect.
Thank you for your information and the link!

Greetings,
Norbert

Feb 4 '07 #3

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

Similar topics

29
by: | last post by:
I did a working code with CDONTS on NT4 Now I am testing is on w2k and it looks like objCDONTS.Send is completely ignored. I think is it ignored because it throws no errors, neither does the...
3
by: DavidS | last post by:
Have parent.aspx from which I open Driver.aspx form via button on parent.aspx. When I first open the modal dialog, the driver.aspx Page_Load function is called. After I close the dialog, then...
0
by: Itai | last post by:
Background: I have four Web Form pages with respective C# code behind files, all in the same project: localhost/vpath1 Page1.aspx Page2.aspx
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) {...
5
by: Jim Bancroft | last post by:
Inexplicably one of my aspx pages is ignoring the Page_Load handler. The page worked fine this morning, but then I added a couple of "using" directives and uncommented a method call about halfway...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
3
by: msnews.microsoft.com | last post by:
Hello I was wondering if someone could help. I have setup Membership login with a ASP.NET 2.0 login control. All works, but I want to do some extra formatting before showing the page. I inserted...
1
by: rockdale | last post by:
Hi, I have a masterpage and on the page_load event I Populate my mainmenu from database. I the page_load event of my content, I am trying to programmly select the menuitem that represent...
11
by: fiefie.niles | last post by:
I am using ASP.NET 2005 and I have a simple form. Page_Load calls a sub mySub that does not do anything (for testing purposes). But, Page_Load gets called twice. On every single ASPX page in my...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.