468,766 Members | 1,303 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,766 developers. It's quick & easy.

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 2364
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jose Fernandez | last post: by
3 posts views Thread by Dan Sikorsky | last post: by
2 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.