MVC :: BeginRequest Event Fires For All Static Files?

Oct 29, 2010

I was under the impression that static files (CSS, images, @font-face files, etc) bypassed ASP.NET completely, and were served directly by IIS. However, my BeginRequest event handler is being called for every HTTP request, including those for static files. This concerns me because I'm creating an Entity Framework data context to be used for the lifetime of each request in that event handler. I don't want to create those contexts if they're never going to be used.

I'm using IIS 7 on Windows 7 Ultimate with so special handler mappings defined. Do I have it wrong? Should these events be firing?

View 2 Replies


Similar Messages:

Web Forms :: URL Routing & PostBack Not Firing BeginRequest Event

Sep 13, 2010

we are having some weird issues with URL Routing in ASP.NET 3.5.

We have a search box that does a search and redirects to a routed URL.

When we search for the first time (aka Press a button that forces a postback) everythign works as expected. we get:

1. BeginRequest event.

2. Determines Route

3. Calls Routehandler to match the route item to the actual destination page

4. Routes the url appropriately.

After you do one search successfully and try again it fails to call the BeginRequest event. Because of this the routing data never gets called and so the url is never routed to its correct destination. What is weirder still if we append a "/" (trailing slash) to the url after the initial postback it DOES work properly again.

So our search route looks like this

mydomain.com/Search

entering a term and pressing the SEARCH button would yield a result url like this:

mydomain.com/Search/Results/MySearchTerm

Going back (after 1 successful search) you then need to use this url or else BeginRequest will never fire:

mydomain.com/Search/ < (note the extra "/" at the end)

why the BeginRequest event never fires unless the slash is appended?

View 1 Replies

Web Forms :: Application BeginRequest Event Raised Too Often To Handle It?

May 6, 2010

I'm developing IP Blacklisting HttpModule in asp .net application and I found one very annoying thing. Each request to the asp net page generates tens of "subrequests" to application resources like images, client side scripts, styles etc.

Now in my application I'm listing to the BeginRequest event and when it is fired I'm loading Dictionary with blacklisted IPs from application cache and check user's IP against it. I've made a simple log of what is actualy happening during each page view, here are the results:

[Code]....

As you see, one request to Login page causes BeginRequest to fire 18 times, there is 18 dictionary loads, 18 lookups etc. That's not the way I want it to be.

Is there any other event that is raised only once per each request? Where do you place the blacklisting mechanism in your applications? I know I can do it through ISAPI filter, but the catch is, this site is on the shared hosting and I'm not sure I can use it on their IIS. Also I'm not sure if ISAPI filter can access some piece of cache with this blacklist (I don't want to load it from DB on each request, that's obvious).

View 3 Replies

Forms Data Controls :: Gridview RowDataBound Event Fires On Every Command Event?

Jul 19, 2010

why the gridview RowDataBound event fires during a select command. I only expect it to run when the gridview is being populated with data. Is there some way to stop it from running when the select command is triggered?

View 3 Replies

JQuery : Which Event Fires In Combobox Before The Change Event

Feb 14, 2011

I want to restrict the user if they select the language which is already selected by displaying alert msg using JQuery.

Is there any event which fires before the change event.

View 2 Replies

How To Create A Base Page Event That Fires After The Derived Page's Load Event

Jun 30, 2010

How do I create a new event in a base page class that fires after all derived pages have fired their load events but before any controls fire their load events.

The following code fires the event before the derived page's load event. I want it to fire the event after the derived page's load event but before all control load events:

Base Class:

Public Event FirstLoad(ByVal sender As Object, ByVal e As System.EventArgs)
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
RaiseEvent FirstLoad(sender, e)
End If
End Sub

Derived Class:

Private Sub Page_FirstLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.FirstLoad
'Stuff here happens before controls load but only on first page loads'
End Sub

View 1 Replies

Ajax - Jquery Event Fires Twice

Feb 10, 2010

I've got the an bit of ajax and the succeed runs twice. I've got a global var that I used to keep track.

Code:
var counter = 0
$('#txtLookupText').keyup(function(event) {
$(document).ready(function() {
});
$.ajax({
type: "POST",
url: 'ContactLookup.aspx/LookupContacts',
data: "{'inputStr': '" + $('#txtLookupText').val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
function AjaxSucceeded(result) {
if (result.hasOwnProperty("d")) { result = result.d; }
var li = ''
for (i = 0; i < result.length; i++) {
li += result[i].FirstName + ' ' + result[i].LastName + '
}
counter += 1
alert(counter)
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}

I moved the counter to the POST and only got one alert box. In the succeed, I get 2 alert boxes in succession.

View 5 Replies

Button Click Event Fires After Two Clicks?

Mar 17, 2011

I have an aspx page that is wrapped with an UpdatePanel control, users can post comments and delete them later, when the user clicks the delete for the first time it deletes successfully but if he wants to delete another comment, it works only after two clicks on the button.the delete button is inside a web user control that is added dynamically at run time.

View 1 Replies

How To Disable LinkButton When OnClick Event Fires

Feb 11, 2010

<asp:LinkButton ID="LinkButtonNewServicesCategory" runat="server"
OnClientClick="this.disabled=true;return false;"
style="float:left;margin-right:5px;" CausesValidation="False">new services category</asp:LinkButton>

The intent is that when the LinkButton is clicked, it disables itself and returns false to prevent the postback (this control is used as a trigger for an animation).

View 1 Replies

C# - Which Event Fires First In The Page Life Cycle And Why

Oct 29, 2010

which event fires first in the page life cycle and why?

View 1 Replies

AJAX :: Which Event Fires When Showing The Modalpopupextender?

Mar 12, 2010

I want to clear the textbox control in the modalpoput at a time of showing it, but i dont know which event fires while ModalpopupExtender show time.

View 2 Replies

Web Forms :: CheckChanged Event Fires On Page Load?

Mar 18, 2011

I can't figure out why, but before my form is even displayed, the CheckChanged event fires. I don't even have a chance to check anything. Has anyone seen anything like this?

View 3 Replies

VS 2008 Ajax - ActiveTabChanged -The Event Fires But Tab Index Is Always 0.

May 10, 2010

I do not seem to be able to capture the tab index when clicking tabs

Code:
<cc1:TabContainer ID="TabContainer1" runat="server" Height="20px" ActiveTabIndex="0"
OnActiveTabChanged="TabContainer1_ActiveTabChanged" AutoPostBack="true">

Code:
Protected Sub TabContainer1_ActiveTabChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Dim myint As Integer
myint = TabContainer1.ActiveTabIndex

End Sub
The event fires in the code behind fires but my tab index is always 0.

View 4 Replies

Web Forms :: Disable Doubclick On Button - No Event Fires?

Nov 12, 2010

I'm trying to prevent the user of double clicking on a submit button.I have been looking arround for the solution but still can't get it to work.

[Code]....

Now when the user clicks on the button it is diabled and the page,load event is fired. But it does not fire the buttons click event.

View 3 Replies

C# - OnCheckedChanged Event Fires More And More Times For Every Time It Is Clicked?

Aug 31, 2010

I have an ASP.NET page that contains a gridview.

I have to create columns dynamically based on a datatable, some field type info and some header texts.

I do that by creating templates.

It created the grid fine and all looks good, however when i click a checkbox and the checkedchanged event fires then something odd happens

The first time i click its fine and i get the expected values in the event

But the second time then the event gets fired with the values from the first time and then again with the values from the checkbox that i actually clicked.. The third time the event gets fired 3 times, first 2 times with the old values and the third with the correct value.

Here is the code:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;........

View 3 Replies

Web Forms :: Page_load Event Fires Two Times In Mozilla?

Oct 19, 2010

Page_load event fires two time in firefox and the same page is working fine in IE. What might be the problem? If it is problem with Autoeventwireup then page_load event must fire two times in IE too. I believe it is not a issue of Autoeventwireup.

how can i find out exactly where the issue is.

View 2 Replies

AJAX :: Onchange Event Fires Twice In Update Panel?

Dec 30, 2010

In my web form, I have dropdown list with autopost back true in ajax update panel. I have javascript alert in Onchange event. But it fire twice and alert msg show it twice

View 3 Replies

Configuration :: No Event Fires Except Page_load In Aspx Page?

Aug 12, 2010

I have a page which contains linkbuttons and panels. all panels have DetalilView and gridView controls. On click of linkbutton, panel's visibility is set. everything works fine on my local server. But on production server, no events of Button, DetailsView and GridView fires.

View 5 Replies

Web Forms :: UserControl Page_load Event Fires Twice Using LoadControl?

Jan 5, 2010

I have a dynamically created user control which is accomplished usingLoadControl().

When I debug, the LoadControl call is called once, however the Page_Load inside the user control is called twice. On each occasion, the postback property is false, so it seems somehow the Page_Load event is called outright 2 times and nothing to do with any postback?

View 15 Replies

C# - Get The Previous Item On DropDownList Before OnSelectedIndexChanged Fires The Event

Jan 26, 2011

How would I get the previous item on DropDownList before OnSelectedIndexChanged fires the event?

I had a DropDownList that has names as its items ("John", "Mark"). By default the SelectedIndex is "John". Upon changing its index and selecting "Mark" the event OnSelectedIndexChanged will be triggered. When I use ddlName.SelectedIndex it will return only the index for "Mark" which I want to get is the index of "John".

View 2 Replies

Web Forms :: No LinkButton Or Button Click Event Fires (no Postback)

Mar 24, 2010

I dont know what happened but none of my buttons or linkbuttons causes a postback anymore. I have dragged a few updatepannels on the page but the linkbutton concerned is not enclosed within an update pannel. when I click it there is just no postback happening anymore. I set the debugger at Page_load but...its not reached. I used firebug to analyse the http requests. there is none. its like those are not considered buttons anymore.

View 5 Replies

Web Forms :: User Control Disappears When Click Event Fires?

Jan 11, 2010

I have the following problem. I have a user control with its own events and procedures. I added this control to a page programmatically. It appears as it should but when you click a button on the user control. the control disappears from the page.

View 6 Replies

AJAX :: How To Partial Post Back Fires Page_Load Event

Feb 4, 2010

Basic concept of AJAX is to cause Partial post back of the Page. If we use AJAX, Page Load occurs, than what is the difference between normal Pages' Page_Load event (without ajax) and Page load event of a Page with ajax.

View 10 Replies

Web Forms :: On-Click Event Fires First Time But Not Subsequent Times?

Aug 2, 2010

I have a LinkButton which fires an OnClick event to update some Labels; however, after the first firing of OnClick, it won't fire again when I click another (or the same) LinkButton which runs the same OnClick event. (It's a list of people, each a LinkButton, and clicking on one brings up their details)

If I leave the page a few minutes, it will work again, almost as if whatever was preventing OnClick firing timed-out. Of course, this won't be any use to the users!

This is my ASP.NET code for the LinkButtons (encapsulated in a DataList):

[Code]....

All the connections work, the data is retrieved, etc, so everything except the OnClick firing works. I've done a search of the internet and the forum, and found this seems to have been a long-standing problem since the first ASP.NET, but there is no solution for ASP.NET 3.5. Does anyone know what causes this, or where I might be going wrong?

View 12 Replies

AJAX :: ControlToolkit TextBoxWatermarkExtender Fires TextChanged Event On Every Postback?

Sep 21, 2010

I haven't been able to find anything on the net about this yet. A project that used to work fine all of a sudden started having trouble with a couple users. The TextBoxWatermarkExtenders for these users are now always firing the TextChanged event of the textboxes they are assigned to for every postback. I don't think this is what they are supposed to do. They didn't use to do this. Has anyone else experienced this? I can add code to ignore these unintentional events, but I would like to know why all of a sudden the change in behavior.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved