Last post Apr 09, 2009 11:48 PM by anup1252000
Apr 09, 2009 02:56 PM|Kaivan|LINK
I have created one httpmodule for url rewriting. It is running fine when I
run application first time but when second time if I do refresh the page
httpmodule is not executing.
When first time httpmodule execute sequence of events are as follow.
1) Application start of global.asax
2) Init event of httpmodule
3) application begin request of global.asax
But when second time I do refresh the page sequence of events are as follow.
1) directly application begin request of global.asax
So I am unable to rewrite url second time.
My code is as follow.
public class Rewriteurl : System.Web.IHttpModule
public void Init(HttpApplication oHttpApplication)
public void Dispose()
public void oHttpApplication_BeginRequest(object sender, EventArgs e)
//url rewrite code
So when I start application at that time httpmodule is executing but when I do refresh httpmodule is not executing.
I tried .PreRequestHandlerExecute event but when first time httpmodule execute so it comes to init event at that time i added PreRequestHandlerExecute event but this event is not executing even first time.When I add beginrequest event it is executing first
time. so my problem is why httpmodule is not executing everyrtime when I request for any page.
Please reply me as soon as possible.
Apr 09, 2009 09:30 PM|ps2goat|LINK
It's hard to follow what you are saying; some of your sentences are running together with mixed problems.
From what you've described, that is what is supposed to happen. If the development server is not running (i.e., you've closed it or you haven't run your project yet), then the first time you run your project the global.asax's Application_Start event will
run. If you close the browser that opens or stop debugging, the development server is still running in the system tray, and the application is still technically running. Exit the development server to go through the complete startup process again.
Anyway, let's get to your real problem. If you are refreshing the page manually using your browser (hitting the Refresh icon or pushing F5), the browser is more than likely pulling the page from a cache. Your HttpModule was initialized during the App_Start,
so it should still be wired in.
Try adding a button to the page you are testing, which simply does Response.Redirect back to itself, sort of a hard-wired refresh. This should give you the ability to debug you module and see what is going on.
If you still have issues, let us know.
Apr 09, 2009 11:48 PM|anup1252000|LINK
go through this vide.. in the end he showed the same by using class library..