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

Home Posts Topics Members FAQ

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 2577
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(HttpApplic ation httpApp)

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

if (httpApp.Contex t.Request.Url.T oString().ToLow er().IndexOf("w ebadmin")
== -1)

httpApp.PreRequ estHandlerExecu te += new
EventHandler(ht tpApp_PreReques tHandlerExecute );

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(obje ct sender, EventArgs e)

{

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

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

}

void httpApp_PreRequ estHandlerExecu te(object sender, EventArgs e)

{

pg = (Page)HttpConte xt.Current.Hand ler;

pg.PreInit += new EventHandler(pg _PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn******** *************** *********@4ax.c om...
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
PreRequestHandl erExecute 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(HttpApplic ation httpApp)

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

if (httpApp.Contex t.Request.Url.T oString().ToLow er().IndexOf("w ebadmin")
== -1)

httpApp.PreReq uestHandlerExec ute += new
EventHandler(h ttpApp_PreReque stHandlerExecut e);

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(obje ct sender, EventArgs e)

{

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

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

}

void httpApp_PreRequ estHandlerExecu te(object sender, EventArgs e)

{

pg = (Page)HttpConte xt.Current.Hand ler;

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 "WebPartZon e is
undefined"
And in the other pages, the same postback error like
'WebForm_PostBa ckOptions' is undefined

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

Thanks.
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:me******** *************** *********@4ax.c om...
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
PreRequestHandl erExecute 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(HttpApplic ation httpApp)

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

if (httpApp.Contex t.Request.Url.T oString().ToLow er().IndexOf("w ebadmin")
== -1)

httpApp.PreRe questHandlerExe cute += new
EventHandler( httpApp_PreRequ estHandlerExecu te);

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(obje ct sender, EventArgs e)

{

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

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

}

void httpApp_PreRequ estHandlerExecu te(object sender, EventArgs e)

{

pg = (Page)HttpConte xt.Current.Hand ler;

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 "WebPartZon e is
undefined"
And in the other pages, the same postback error like
'WebForm_PostB ackOptions' 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 "WebPartZon e is
undefined"
And in the other pages, the same postback error like
'WebForm_PostB ackOptions' 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
PreRequestHandl erExecute 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(HttpApplic ation httpApp)

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

if (httpApp.Contex t.Request.Url.T oString().ToLow er().IndexOf("w ebadmin")
== -1)

httpApp.PreR equestHandlerEx ecute += new
EventHandler (httpApp_PreReq uestHandlerExec ute);

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(obje ct sender, EventArgs e)

{

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

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

}

void httpApp_PreRequ estHandlerExecu te(object sender, EventArgs e)

{

pg = (Page)HttpConte xt.Current.Hand ler;

pg.PreInit += new EventHandler(pg _PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn***** *************** ************@4a x.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.c om...
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 "WebPartZon e is
undefined"
And in the other pages, the same postback error like
'WebForm_Post BackOptions' 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
PreRequestHandl erExecute 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(HttpApplic ation httpApp)

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

if (httpApp.Contex t.Request.Url.T oString().ToLow er().IndexOf("w ebadmin")
== -1)

httpApp.Pre RequestHandlerE xecute += new
EventHandle r(httpApp_PreRe questHandlerExe cute);

}

public void Dispose()

{

// not necessary

}
void pg_PreInit(obje ct sender, EventArgs e)

{

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

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

}

void httpApp_PreRequ estHandlerExecu te(object sender, EventArgs e)

{

pg = (Page)HttpConte xt.Current.Hand ler;

pg.PreIni t += new EventHandler(pg _PreInit);

}

}

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:qn**** *************** *************@4 ax.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 #8

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

Similar topics

14
3892
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 maxRequestLength parameter of the <httpRuntime> section and that works as expected. What I want is to enforce a max file size but haven't been able to trap the error thrown when the file is too large and that's where I could use some help.
25
17213
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 being uploaded. I'm also using the HtmlInputFile control to do the uploading. My problem is that when the user's file size exceeds 512k, the page immediately redirects to the "The page cannot be displayed" error page which is very confusing. ...
4
1486
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 ----------- A sequence of user interactions span multiple ASP.NET http POST PostBacks within the same page. There is a need to be able to identify each step of the interaction at the web server level (using a log analyzer such as WebTrends). ...
9
3214
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 questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network share that happens to be a Network Appliance NAS.
2
2141
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) Implements IHttpModule.Init httpApp = context
1
17044
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 control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
3
2183
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 declared of course into the Webconfig. This application runs perfect. So, i created another application (Accreditation), that runs perfect too inside of it as a virtual directory that does not use HttpModule. Now i am getting this error....
3
2242
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 any interested parties. Finally, a user friendly page (GenericError.aspx) is Redirected To. My Page_Load event has no code, so when the page is unavailable, (for instance, the website is down), an unhandled event is generated and my HttpModule...
2
2175
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. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/in configuration or <%@ Page EnableEventValidation="true"...
0
8983
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
8822
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9359
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...
0
9236
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...
1
6792
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
6072
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();...
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.