473,406 Members | 2,378 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,406 software developers and data experts.

Postback error after using HttpModule

Folks,
I develop a HttpModule and it works correct, but one problem is occurs.
After I register the httpmodule in the web.config, my pages (not testing
http://localhost/site but http://my_machine_name/site) show problems when
refresh the page.
I guess some kind of javascript problems with the postback methods.

Someone has any idea how can i fix it?

Thanks

nail
Nov 18 '05 #1
7 2563
Hi nail:

We would have to know a little bit about what the HttpModule does. Can
you post some code?

--
Scott
http://www.OdeToCode.com/

On Wed, 6 Oct 2004 19:10:51 -0300, "nail" <na**@seaforce.net> wrote:
Folks,
I develop a HttpModule and it works correct, but one problem is occurs.
After I register the httpmodule in the web.config, my pages (not testing
http://localhost/site but http://my_machine_name/site) show problems when
refresh the page.
I guess some kind of javascript problems with the postback methods.

Someone has any idea how can i fix it?

Thanks

nail


Nov 18 '05 #2
Ok Scott.
Here's the httpmodule class:
Thanks again.

public class STHttpModule : IHttpModule

{

private Page pg;

public void Init(HttpApplication httpApp)

{//Check if the page is the asp.net configuration. if is, not execute the
http module handler.

if (httpApp.Context.Request.Url.ToString().ToLower(). IndexOf("webadmin")
== -1)

httpApp.PreRequestHandlerExecute += new
EventHandler(httpApp_PreRequestHandlerExecute);

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(object sender, EventArgs e)

{

if (pg.Request["CurrentTheme1"] != null)

pg.Theme = pg.Request["CurrentTheme1"].ToString();

}

void httpApp_PreRequestHandlerExecute(object sender, EventArgs e)

{

pg = (Page)HttpContext.Current.Handler;

pg.PreInit += new EventHandler(pg_PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn********************************@4ax.com...
Hi nail:

We would have to know a little bit about what the HttpModule does. Can
you post some code?

--
Scott
http://www.OdeToCode.com/

On Wed, 6 Oct 2004 19:10:51 -0300, "nail" <na**@seaforce.net> wrote:
Folks,
I develop a HttpModule and it works correct, but one problem is occurs.
After I register the httpmodule in the web.config, my pages (not testing
http://localhost/site but http://my_machine_name/site) show problems when
refresh the page.
I guess some kind of javascript problems with the postback methods.

Someone has any idea how can i fix it?

Thanks

nail

Nov 18 '05 #3
Hi nail:

One thing that seems a little odd is the way you check the Url
property during Init. The Init method will only be invoked once and
then the module will be reused for several requests. If the first
request then, is not for "webadmin", then you'll never be hooking the
PreRequestHandlerExecute event.

Instead, I'd always hook that event and then check the URL during the
Begin_Request event.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 09:12:32 -0300, "nail" <na**@seaforce.net> wrote:
Ok Scott.
Here's the httpmodule class:
Thanks again.

public class STHttpModule : IHttpModule

{

private Page pg;

public void Init(HttpApplication httpApp)

{//Check if the page is the asp.net configuration. if is, not execute the
http module handler.

if (httpApp.Context.Request.Url.ToString().ToLower(). IndexOf("webadmin")
== -1)

httpApp.PreRequestHandlerExecute += new
EventHandler(httpApp_PreRequestHandlerExecute);

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(object sender, EventArgs e)

{

if (pg.Request["CurrentTheme1"] != null)

pg.Theme = pg.Request["CurrentTheme1"].ToString();

}

void httpApp_PreRequestHandlerExecute(object sender, EventArgs e)

{

pg = (Page)HttpContext.Current.Handler;

pg.PreInit += new EventHandler(pg_PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn********************************@4ax.com.. .
Hi nail:

We would have to know a little bit about what the HttpModule does. Can
you post some code?

--
Scott
http://www.OdeToCode.com/

On Wed, 6 Oct 2004 19:10:51 -0300, "nail" <na**@seaforce.net> wrote:
Folks,
I develop a HttpModule and it works correct, but one problem is occurs.
After I register the httpmodule in the web.config, my pages (not testing
http://localhost/site but http://my_machine_name/site) show problems when
refresh the page.
I guess some kind of javascript problems with the postback methods.

Someone has any idea how can i fix it?

Thanks

nail


Nov 18 '05 #4
Ok Scott, now I check if the page is webadmin in the Begin_Request event.
But the problem continues.
And in pages with webparts, I get javascript erros like "WebPartZone is
undefined"
And in the other pages, the same postback error like
'WebForm_PostBackOptions' is undefined

I don't know how can I fix it!!

Thanks.
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:me********************************@4ax.com...
Hi nail:

One thing that seems a little odd is the way you check the Url
property during Init. The Init method will only be invoked once and
then the module will be reused for several requests. If the first
request then, is not for "webadmin", then you'll never be hooking the
PreRequestHandlerExecute event.

Instead, I'd always hook that event and then check the URL during the
Begin_Request event.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 09:12:32 -0300, "nail" <na**@seaforce.net> wrote:
Ok Scott.
Here's the httpmodule class:
Thanks again.

public class STHttpModule : IHttpModule

{

private Page pg;

public void Init(HttpApplication httpApp)

{//Check if the page is the asp.net configuration. if is, not execute the
http module handler.

if (httpApp.Context.Request.Url.ToString().ToLower(). IndexOf("webadmin")
== -1)

httpApp.PreRequestHandlerExecute += new
EventHandler(httpApp_PreRequestHandlerExecute) ;

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(object sender, EventArgs e)

{

if (pg.Request["CurrentTheme1"] != null)

pg.Theme = pg.Request["CurrentTheme1"].ToString();

}

void httpApp_PreRequestHandlerExecute(object sender, EventArgs e)

{

pg = (Page)HttpContext.Current.Handler;

pg.PreInit += new EventHandler(pg_PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn********************************@4ax.com. ..
Hi nail:

We would have to know a little bit about what the HttpModule does. Can
you post some code?

--
Scott
http://www.OdeToCode.com/

On Wed, 6 Oct 2004 19:10:51 -0300, "nail" <na**@seaforce.net> wrote:

Folks,
I develop a HttpModule and it works correct, but one problem is occurs.
After I register the httpmodule in the web.config, my pages (not testing
http://localhost/site but http://my_machine_name/site) show problems
when
refresh the page.
I guess some kind of javascript problems with the postback methods.

Someone has any idea how can i fix it?

Thanks

nail

Nov 18 '05 #5
I know it only happens when you register the module, but I can't see
anything in the code that would cause the javascript to screw up...

Something I might do is a View Source on the page with and without the
module registered, and diff them to see what is changing. That might
give a clue as to where the problem is. Know what I mean?

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 12:15:24 -0300, "nail" <na**@seaforce.net> wrote:
Ok Scott, now I check if the page is webadmin in the Begin_Request event.
But the problem continues.
And in pages with webparts, I get javascript erros like "WebPartZone is
undefined"
And in the other pages, the same postback error like
'WebForm_PostBackOptions' is undefined

I don't know how can I fix it!!

Thanks.


Nov 18 '05 #6
Say, any chance you are trying to dynamically load a theme in ASP.NET
2.0? You might want to check out a new article, it covers that topic:
http://msdn.microsoft.com/asp.net/wh...tml/themes.asp

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 12:15:24 -0300, "nail" <na**@seaforce.net> wrote:
Ok Scott, now I check if the page is webadmin in the Begin_Request event.
But the problem continues.
And in pages with webparts, I get javascript erros like "WebPartZone is
undefined"
And in the other pages, the same postback error like
'WebForm_PostBackOptions' is undefined

I don't know how can I fix it!!

Thanks.
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:me********************************@4ax.com.. .
Hi nail:

One thing that seems a little odd is the way you check the Url
property during Init. The Init method will only be invoked once and
then the module will be reused for several requests. If the first
request then, is not for "webadmin", then you'll never be hooking the
PreRequestHandlerExecute event.

Instead, I'd always hook that event and then check the URL during the
Begin_Request event.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 09:12:32 -0300, "nail" <na**@seaforce.net> wrote:
Ok Scott.
Here's the httpmodule class:
Thanks again.

public class STHttpModule : IHttpModule

{

private Page pg;

public void Init(HttpApplication httpApp)

{//Check if the page is the asp.net configuration. if is, not execute the
http module handler.

if (httpApp.Context.Request.Url.ToString().ToLower(). IndexOf("webadmin")
== -1)

httpApp.PreRequestHandlerExecute += new
EventHandler(httpApp_PreRequestHandlerExecute );

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(object sender, EventArgs e)

{

if (pg.Request["CurrentTheme1"] != null)

pg.Theme = pg.Request["CurrentTheme1"].ToString();

}

void httpApp_PreRequestHandlerExecute(object sender, EventArgs e)

{

pg = (Page)HttpContext.Current.Handler;

pg.PreInit += new EventHandler(pg_PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn********************************@4ax.com ...
Hi nail:

We would have to know a little bit about what the HttpModule does. Can
you post some code?

--
Scott
http://www.OdeToCode.com/

On Wed, 6 Oct 2004 19:10:51 -0300, "nail" <na**@seaforce.net> wrote:

>Folks,
>I develop a HttpModule and it works correct, but one problem is occurs.
>After I register the httpmodule in the web.config, my pages (not testing
>http://localhost/site but http://my_machine_name/site) show problems
>when
>refresh the page.
>I guess some kind of javascript problems with the postback methods.
>
>Someone has any idea how can i fix it?
>
>Thanks
>
>nail
>


Nov 18 '05 #7
Hi Scott.
Yeah man, I read the article and I know that.
To change the theme in runtime I need to handle the PreInit event.
But remember, I developing a custom control. And I can't want, after put my
control in the page, write an any code in the PreInit event of the page.
After all, I can't put any code in all pages os my project.

If I am not use httpmodule, I cannot get the PreInit event of the page. The
httpmodule is the only way I know.
Understand me now?

Thanks again for your greater help.
If you know anything, send me email in fer.lopes@[nospam].com.br

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:19********************************@4ax.com...
Say, any chance you are trying to dynamically load a theme in ASP.NET
2.0? You might want to check out a new article, it covers that topic:
http://msdn.microsoft.com/asp.net/wh...tml/themes.asp

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 12:15:24 -0300, "nail" <na**@seaforce.net> wrote:
Ok Scott, now I check if the page is webadmin in the Begin_Request event.
But the problem continues.
And in pages with webparts, I get javascript erros like "WebPartZone is
undefined"
And in the other pages, the same postback error like
'WebForm_PostBackOptions' is undefined

I don't know how can I fix it!!

Thanks.
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:me********************************@4ax.com. ..
Hi nail:

One thing that seems a little odd is the way you check the Url
property during Init. The Init method will only be invoked once and
then the module will be reused for several requests. If the first
request then, is not for "webadmin", then you'll never be hooking the
PreRequestHandlerExecute event.

Instead, I'd always hook that event and then check the URL during the
Begin_Request event.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 09:12:32 -0300, "nail" <na**@seaforce.net> wrote:

Ok Scott.
Here's the httpmodule class:
Thanks again.

public class STHttpModule : IHttpModule

{

private Page pg;

public void Init(HttpApplication httpApp)

{//Check if the page is the asp.net configuration. if is, not execute
the
http module handler.

if (httpApp.Context.Request.Url.ToString().ToLower(). IndexOf("webadmin")
== -1)

httpApp.PreRequestHandlerExecute += new
EventHandler(httpApp_PreRequestHandlerExecute) ;

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(object sender, EventArgs e)

{

if (pg.Request["CurrentTheme1"] != null)

pg.Theme = pg.Request["CurrentTheme1"].ToString();

}

void httpApp_PreRequestHandlerExecute(object sender, EventArgs e)

{

pg = (Page)HttpContext.Current.Handler;

pg.PreInit += new EventHandler(pg_PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn********************************@4ax.co m...
> Hi nail:
>
> We would have to know a little bit about what the HttpModule does. Can
> you post some code?
>
> --
> Scott
> http://www.OdeToCode.com/
>
> On Wed, 6 Oct 2004 19:10:51 -0300, "nail" <na**@seaforce.net> wrote:
>
>>Folks,
>>I develop a HttpModule and it works correct, but one problem is
>>occurs.
>>After I register the httpmodule in the web.config, my pages (not
>>testing
>>http://localhost/site but http://my_machine_name/site) show problems
>>when
>>refresh the page.
>>I guess some kind of javascript problems with the postback methods.
>>
>>Someone has any idea how can i fix it?
>>
>>Thanks
>>
>>nail
>>
>

Nov 18 '05 #8

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

Similar topics

14
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the...
25
by: moondaddy | last post by:
I have an application where users need to upload images and in my web.config file I have a setting like this: <httpRuntime maxRequestLength="512" /> Which restricts image larger than 500k from...
4
by: Peter Jaffe | last post by:
I've seen a few posts on this topic, but still haven't found a clean solution. Anyone have other suggestions or feel that one of the options I highlight below is the way to go? The Problem...
9
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
2
by: Simon-Pierre Jarry | last post by:
Hi, I created a custom HttpModule for managing the security of my application. in "Init" sub, I regsiter the events doing that : Public Sub Init(ByVal context As System.Web.HttpApplication)...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
3
by: Jose Fernandez | last post by:
HI first of all, excuse me for my english. And Thank in advance for even read my post. I have a problem that is driving me insane. I have an application (JUCAR) which use HttpModule and i have...
3
by: Dan Sikorsky | last post by:
I use an HttpModule that handles unhandled exceptions from an .aspx.cs page by logging to a text file, logging to the event viewer's app log, and sending out an email to the website developer and...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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...
0
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...
0
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...
0
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,...
0
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...

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.