Web Forms :: Application_End Not Firing
Feb 17, 2011I am trying to log the reason the application has ended.I have tried a bunch of things, but it does not seem that the Application_End event in global.asax fires.
[code]...
I am trying to log the reason the application has ended.I have tried a bunch of things, but it does not seem that the Application_End event in global.asax fires.
[code]...
Application_Start and Application_End are called only once during the lifetime of the application domain - thus they aren't called for each HttpApplication instance
Application_Start runs when first user requests a page, thus when the first instance of the HttpApplication class is created, while Application_End runs when the last instance of an HttpApplication class is destroyed.
But what if at the time of application domain being restarted there wasn't any user requests and thus no HttpApplication instances created? Will in that case Application_End still be fired?
How can you obtain the 'mydomain.com' part of a url within Application_End?
View 2 Replieswill the application_end event in global.asax gets called when all users end there session?
was it like this in the past maybe?
in my Global.asax I have a timer and every 24 hours it creates an instance of a class and calls a method to send reminder emails with an attachment. In this method I am getting the current HttpContext and using Server.MapPath to get the path to the attachment, but it is always null. I guess this is because Application_End has been called between the last user accessing the site and the method being called.
As a workaround I am setting the timer interval to 19 minutes but I would rather not call the method 36 times a day when only once is required.
Is there any way, apart from hard coding the path, to ensure the HttpContext is not null?
We have a component that needs to sit in asp.net that creates a listening socket on a well known port.The reason we have the socket is the asp.net need component needs to received events from external services and other technologies weren't quick or flexible enough.We start the socket listening in application_start,and close the socket in application_end. The issue is if we are receiving http requests to the web site, and modify the web.config, the application_start event is called before the application_end is called,so we cannot open the socket (we get an error about duplicate socket being open). We dont have a reference to the original socket in the application_start after the web.config change, so we cannot shut it down from there.
View 3 RepliesI want to be able to maintain certain objects between application restarts.
To do that, I want to write specific cached items out to disk in Global.asax Application_End() function and re-load them back on Application_Start().
I currently have a cache helper class, which uses the following method to return the cached value:
return HttpContext.Current.Cache[key];
Problem: during Application_End(), HttpContext.Current is null since there is no web request (it's an automated cleanup procedure) - therefore, I cannot access .Cache[] to retrieve any of the items to save to disk.
Question: how can I access the cache items during Application_End()?
I'm sure I'm missing something extremely obvious here, but at this point I can't see it so I need the help.Anyway, I've got a repeater inside of an UpdatePanel. As of right now, I've stripped it down to this, just to try and isolate the problem:
[Code]....
Whether I add the handler during itemdatabound or I add the handler within the repeater itself, it doesn't seem to matter...the event itself doesn't fire. The AutoPostback itself seems to fire, but the event itself doesn't.
I'm running VS 2008 and .NET 3.5 SP1.
I want to implement hit tracking in an HttpModule in my ASP.NET app. Pretty simple, I thought. However, the BeginRequest event of my HttpModule is firing twice for each page hit. The site is very simple right now...no security, just a bit of database work. Should log one row per page hit. Why is this event firing twice?
Moreover, IHttpModule.BeginRequest actually fires a different number of times for the first page hit when running for the first time (from a closed web browser)...3 times when I'm hitting the DB to provide dynamic data for the page, and only 1 time for pages where the DB isn't hit. It fires 2 times for every page hit after the first one, regardless of whether or not I'm touching the DB.
It's interesting to note that Application_BeginRequest (in Global.asax) is always firing only once.
I have a problem with dropdown list. I have two dropdown lists on my web page. On page load event i have populated my first dropdown list which is working fine. I want to populate my second dropdownlist based on the selected value of first one , But theSelectedIndexChanged of my first event is not firing even i have set AutoPostBack property to true.
View 9 RepliesButton click is not firing for some reason. This button is in a content page.(Master page)
I am not sure what is happening.
I've stepped through the code and verified this action. It gets to the end sub and just loops again. Also does it on the production server in IE and Chome (that's all I've tried). Here is the button definition on the actual ASP page:
[Code]....
It goes through the code, sends me an email, gets to End Sub, then loops right back to the top of the sub and goes through the whole thing again, sending me a duplicate email, then exiting normally and sending them to the About page. This is the only code in the aspx.vb besides the class def and inherits statement.
Something strange is going on. I have requiredfieldvalidators on 2 textboxes. I enter data and I cannot click the asp button. but when i remove the validation group I can click the button.
[Code]....
There are 2 boxes within the group
And the lower button. Any ideas why this isn't working? I enter info into all textboxes and I still can't fire the button event. Remove the group and it's fine.
I'm sure this is an easy one, but when I'm not using a code behind, I can get the Literal to change to my default text, but when I am using the code behind to insert my code, it's acting as if the Page Load event doesn't fire off, and the default text ofText to display2 is still shown, when it should show test. Can anyone show me what I've done wrong?
CodeBehind Page
[Code]....
Code Page
[Code]....
[URL] and that is not my problem.
I have a page with some updatepanels and som jquery code. Within an updatepanel, I have some dropdownlists that are filled bases on its precedenting. Basic.
On other browser it works very well, but in IE the postback is fired twice, and my application doesn't works properly.
If i remove soem jquery scripts, it works well. But I can't see any explanation for that and I can't remove jquery code.
The jquery code dos a datepĂcker, autcomplete, inputmask and some calculation.
I will go into the background of why i am wanting to do this if necessary but in short. I want to create a WebControl which has a button on it. I provide the most simple of examples to understand why it is not working.
No matter what i try my button event doesnt seem to fire. the code for it is here:
[Code]....
This page:
[Code]....
What am i doing wrong? why wont events fire?
I have a two web forms with griviews that are bound to SQL through the same query in a class. Both have the same columns and footers. Both have a checkbox control in each grid row. The checkboxes on each form have OnCheckChanged event handlers that I put in the code behind. In fact, the html code is almost the same on both forms, and the OnCheckChanged code is exactly the same except for the fact that I have named them differently. AutoPostBack is true for both checkbox controls in the gridviews. One works, the other doesn't. The difference between the two is that the gridview row checkboxes that don't work are burried in a MultiView. Could that be why the codebehind event handler doesn't fire? Here is the html for the column:
[Code]....
Here is the html for the header of the gridview:
[Code]....
Here is the codebehind:
[Code]....
In the source code, there was a JavaScript function isValidInput() for form onsubmit event, i.e., onsubmit="return isValidInput()"
In VS2003, this function was not called when SelectedIndexChanged event in DropDownList boxes was fired.
In VS2008, this function was called when SelectedIndexChanged event in DropDownList boxes was fired.
In either case, DropDownList had property AutoPostBack="true".
Before, when a user selected a different list index from DDL, it won't check validation. It validated inputs only when a user clicked on Send button to submit this form. So, it worked.
Now, when a user selected a different list index from DDL, it WILL check validation. User can go nowhere since he/she need more input based the selected item in DDL. So, now it does work.
How to get around this? how to make dropdownlist not fire javascript function on "selection changed"?
I have a div in which i have few text boxes and checkboxes, i wrote checkboxchanged event but it is not firing when i check or uncheck the checkbox i set the autopostback property of the checkbox = true but still no result. does any one have idea how to control this scenario.
View 6 RepliesI'm facing a weird issue...My button events are not firing :(I'm using the 3.5 .net framework and I've already tried to run aspnet_regiis -c, clear the browser temp files, use windows integrated authentication, but nothing works...this is the cenario:
- windows server 2003
- app migrated from .net framework 1.1 (which was working fine) to .net framework 3.5
- IE8
I have a ascx like below
<%@
Control
Language="C#"
[code]...
I have an asp.net 2.0 c# site.
In that site, I have a drop down list which allows the user to select from a number of forms with AutoPostBack set to true. I have a OnSelectedIndexChanged event on the dropdown which loads the correct control depending on which option is selected. See below:
[Code]....
Now, that works correctly and loads the form as expected, but the server side onclick event within each ascx control now doesn't work. Is there some problem with button events when controls are added this way? When I add the control in manually to the page it works fine.
i'm creating and adding checkbox in my code behind to a parent control.
autopost back is true, it's posting back on being checked, but i'm not sure how to capture the fact that it's checked before I recreate/add it to the parent control again.
i can search all controls and find it prior to re adding it to the parent, but it never shows checked...
i have a checkchanged event on it that never fires, thing it's a flow/view state issue, but not sure how to reslove...
I am having a problem with web pages in a .Net site where the Page_Init is firing on each postback rather than the normal behavior (Page_Init fired initially, and only Page_Load fired on postbacks)
Several comments:
1. AutoEventWireup is set to false on all pages, with a "Handles Me.Init" set on Page_Init. All events are defined with the "Handles" verb as shown below
2. Each web page is subclassed to a parent class which provides strongly-typed access to the contents of session variables.
3. The Page_Load event for most of the pages performs a DataBind operation on a gridview control.
Partial Public Class SamplePage
Inherits PageManager (PageManager inherits from System.Web.UI.Page)
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
...
End Sub
I added some code to Global.asax on app start and I had to copy same project on a different machine and suddenly Global.asax file's event didn't fire. After doing lot of googling and trying many things I deleted the existing Global.asax and added a new one and then tested it. And I was surprised that it started to work again. so I would like to know what caused that previous Global.asax not to work?
View 5 Replies