Application_BeginRequest
from the Global.asax.cs and put this into my webform as inline code?
I think the event you are looking for is ?Sub Application_Start(ByVal senderAsObject,ByVal eAs EventArgs)
' Code that runs on application startup
EndSub
Thanks but I need it to fire on every postback, not just on application start-up, so something along the lines of (in c#):
private void Application_BeginRequest(Object Sender, EventArgs e)
{
Response.Write("test");
}
I think its the same name as the event in vb too.
you could create a .cs class that would reside in your App_Code folder and then create your function in it. Then in what ever page you need it you would:
if page.ispostback then
Dim gbFunctionsAsNew globalServerFuncitons // The name of the class
Then gbFunctions.YourFunctionNameInTheClass
end if
I guess I should have explained the problem a little more clearly.. The reason I need this event before the page is requested is because of problem with IIS 5.1 (http://support.microsoft.com/?id=910436)
I am uploading several files using file upload controls but each time a postback occurs (i.e. i submit the form) - i am sent to a dns error page because my file sizes total more than my specified limit in the web config.
I therefore am trying to catch the error before the application requests the file headers and throws you to the very unelegant dns error page as described by the microsoft article above.
SO the example workaround they have given in that article i am trying to incorporate using inline code (not code behind). The reason being is because we use several applications that I am writing the upload component for and my task was to create a single .aspx webform that kept all scripts (c#, javaScript, html) all in the one place so we can easily configure it when re-using in the many other apps we have.
Because of this issue the code will never reach the page load event, only the app start, begin request, and on error of the application (in global). So I need to program one of these into my webform.
Does all the above make sense?
So this error occurs on the client and not the server?
0 comments:
Post a Comment