MVC :: 3.0 Beta: IFilterProvider.GetFilters Called 4 Times Per Request?

Oct 20, 2010

I implemented a custom IFilterProvider derived from FilterAttributeFilterProvider and

registered it using a Unity based dependency resolver. (Pretty much as described on

Brad Wilson's blog.) While debugging, I noticed that IFilterProvider.GetFilters on my

custom class get called a lot. I counted 4 times per request.

Is this normal or am I doing something wrong?

I have a simple project that reproduces the behavior if anyone is interested.

View 1 Replies

Similar Messages:

State Management :: IPartitionResolver.ResolvePartition Called Many Times Per Request?

Jan 6, 2011

I have a .NET 3.5 web application that uses SQL Server for its session state store. To improve scalability I wrote a class that implements IPartitionResolver that figures out which instance of SQL Server to use for a users session. All of this works great
and just as expected.

However, when I was debugging one day I set a breakpoint at the bottom of the ResolvePartition method to make sure the correct connection string was being returned. To my surprise this breakpoint was hit many (~5-10) times per request! The same is true about breakpoints in the IPartitionResolver.Initialize method.

Does anyone know why this is? It seems to me that you would only need to call these methods once per request. It's not like the users session is going to move to a different instance of SQL Server mid request.

View 1 Replies

MVC :: Initialize Method Called Multiple Times?

Jul 6, 2010

I'm overriding the Controller.Initialize method to set some stuff before each ActionResult is executed, however I'm finding that the method is being called multiple times for each request (anywhere between 2 - 10 times). I'm running in Cassini.

My hunch is that it is running for all static files (images, css etc) as well as the requested action - although I may be wrong? I thought maybe something was wrong in my web.config but it all looks right to me.

View 6 Replies

MVC :: Application_start Event Called Multiple Times In Application

Sep 15, 2010

In my MVC application ,I am updating my web.config at runtime through application_start event.So, ideally it should be done only when the application is started.BUT in MY mvc application the application_start event of global.asax is being called multiple
times , even when i have not restarted the application.

Its being repetadly called when i am calling different actions , so the webconfig is repetedly updating & making my application very very slow. what's the reason & how to handle this .

View 2 Replies

Web Forms :: Login Page To Load 9 Times Each Time The Web App Is Called?

Feb 22, 2011

Using Forms authentication, for some reason my login page is called 9 times. it causes some browsers to show "too many redirects!". Even with no javascript and nothing in the page_load event, it is called 9 times.

View 2 Replies

How Many Times Does HttpModule Init() Method Get Called During Application's Life

Jul 30, 2010

Web application initialization is as follows:

As we know when IIS receives the first request for a particular application resource, IIS creates an instance of a HttpApplication (defined in global.asax codebehind).When this new instance is created it's initialization happens that also checks all configured HTTP modules.All modules are then instantiated and put in the application's Modules collection (of type HttpModuleCollection)modules are looped through and their Init() method is called (when they register for request events)

As far as I understand it the above scenario happens when a web application is started/initialized (hence application start event).What happens with modules?

Are they (re)instatiated on each request or reused from the Modules property on each consecutive request while the web application is alive? As I understand IIS and they are reused through the whole life of a web application.

If they are reused, can we assume that their Init() method is actually a pseudo event handler for application start event? The thing is we can't attach to application level events within http modules. But if they are being reused we could use Init() as application start event and do whatever we'd put in global.asax instead.

Question,Can we assume that module's Init() method is called only on application start event? Could we use this assumption to i.e. register routes for applications whose global.asax codebehind we can't change? web.config is usually accessible and we can change it the way we want.Would this actually work?

Additional info,We can check HttpApplication code and check its InitModulesCommon() method. This one actually calls Init() of each registered HTTP module. What is more interesting is that this method is only used by InitIntegratedModules() and InitModules() methods. Which are both used only in HttpApplication.InitInternal() method. This is the basis of my assumptions, but I would like to know whether someone has abused IHttpModule.Init() for application start event.

View 3 Replies

C# - Grid Data Bound To Stored Procedure Getting Called Multiple Times?

Mar 8, 2011

I have an application that uses an aps:GridView. The GridView is populated using a DataSource that calls a Stored Procedure. The DataSource passes parameters to the Stored Procedure based on some text fields. The page has been running slower than wanted, so I was doing some checking.

I ran SQL Profiler while loading the page, and saw the Stored Procedure was being called twice. I stepped through the code and found out that in the Page Load Complete event was where this was happening. In this event, I set the value of a parameter for the Stored Procedure, then did a DataBind on the GridView to pick up the data. As I was stepping through the code, I watched the SQL Profiler. When I got to the step of setting the parameter, the Stored Procedure had not yet been called. When I stepped through that and got to the DataBind command (before running that step), the SQL Profiler showed that the Stored Procedure had been called. Then I did the DataBind and the StoredProcedure was called again.

My question is, how do I get the parameters set, and get the GridView data bound, and only call the StoredProcedure once? If I comment out the DataBind step, the StoredProcedure never does get called (which seems really strange to me...).

View 1 Replies

Ajax Request Times Out (or Is Really Slow)

Nov 15, 2010

My basic structure is that I have a table on a page, which I want to reload without refreshing the entire page. So on clicking a button on the page it fires of this:

function RefreshMissionsAjax() {
//fade out the old table.
//request the new value from the page (calls the GetIncompleteMissions() method in the MissionViewer.aspx.cs page)
type: "POST",
url: "MissionViewer.aspx/GetIncompleteMissions",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
error: function (xhr, ajaxOptions, thrownError) {
$(clientID('MissionsDisplay')).html('An error occured while trying to refresh the page data.');
And I have in the code bedind of an aspx page:
public static string GetIncompleteMissions()
return GetHTMLTable();

This method just grabs some data, and creates a html table - nothing too fancy. When the returned table is small (a dozen rows or less) then it works like a charm. But when it gets larger, it takes a long long time. At 100 rows it can take 5 minutes to render the table. At 1000 rows I have left it for 30 minutes and nothing will happen after the fadeout. (NB - it loads fairly quickly on the pageload, before the ajax refresh is used, so it is not the actual server side creation of the table thats the problem).

This is my first real attempt at doing something like this, so I dont know if this is the best way to do it - it was just something i pieced together that worked great when i was testing with small datasets. Now, not so much.

View 1 Replies

SelectMethod In ObjectDatasource Getting Called Multiple Times With Multiple Datapagerfield?

Oct 7, 2010

so here is the setup. I am building a page that has a listview, a datapager, and 3 datapagerfield (2 x NextPreviousPagerField, 1 x NumericPagerField), and a objectdatasource to tide all of this together.

It was all working fine until I put a breakpoint into the SelectMethod specified in the objectdatsource control. It seems like that for each datapagerfield control, it is calling the selectmethod and selectcount method. Hence, whenever a user paged, it calls the database 6 times instead of 2 (I don't have caching turned on atm). If I remove one datapagerfield, it will remove 2 calls.

Now this is build in 3.5 SP1 in VS2008. When I copied the same code files to a 4.0 VS2010 solution, it duplicate call seems to be gone.

Is this a bug in 3.5 SP1?

View 1 Replies

Access A Database Table Multiple Times For Every Request?

Mar 16, 2011

A class in my ASP.NET website needs to access a database table multiple times for every request. The database table should rarely change, if ever. Maybe a couple times a month.

In the static constructor of the class, the table is fetched from the DB and cached in a static local variable. Whenever the class needs to access the table, then, it just uses the cached, static version.

My question concerns the lifespan of this cached, static version of the table.

I understand that it's fetched the first time the class is instantiated or a static method in the class is used. But how often does this occur on the web server? What if the table changes and we want to reset this static version of the table?

Basically, I'm wondering, is this table fetched once and then only refetched each time I restart IIS? What, with regard to the site and IIS, will trigger this static class to reset, causing the static table to be refetched?

View 3 Replies

AJAX :: Request Takes A Few Minutes Then Times Out - Only In Firefox

Nov 22, 2010

I have a very peculiar problem that I've been wrapping my head around and I just can't figure it out. I have an updatepanel. Inside that I have a TabContainer. And inside that I have three TabPanels, each of which has checkboxes. Sometimes (and it happens often enough that I can easily reproduce it, but strangely may not happen with the same exact steps), when I click on different tabs or click on checkboxes inside the tabpanels (basically when I do an AJAX async postback), the request takes about a few minutes, after which the request just stops. Looking at the Firefox error console, I see this popping up after a few minutes...

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0 Now, the asyncpostbacktimeout property for the ToolkitScriptManager is set at 360000, which is 6000 minutes, so the problem has nothing to do with that setting. In IE, I never have this problem and the AJAX requests are instantaneous and smooth, no delays. So this isn't a network or database lag issue. Something to do with how AJAX is run in Firefox. Why is it that sometimes, an AJAX request in Firefox takes a few minutes and just stops processing the request? And once again, the steps to reproduce this problem may not be the same every time, it seems random - very strange. Google searches have yielded very little help on this. I've tried things like extending the timeout property (which again has nothing to do with this), setting Response.Cache.SetNoStore() everywhere. Is there a crude workaround I can do (at this point, I'm willing to settle for a workaround). I just don't know anymore.

View 1 Replies

Controller Method Not Always Called From $.getJSON Request?

Mar 9, 2010

I have a controller method that returns a jSON object and in one calling situation, it works and in another calling situation, it does not work. When the URL in my browser is this:

http://localhost:65247/Client -- it works.

But, when my url looks like this:

http://localhost:65247/Client/UserAdmin?id=6 -- it DOES NOT work

In a nutshell, clients have users. From within the client, I wish to work on a specific user (this is the UserAdmin view). In this case, the client id is 6. From within the UserAdmin view that was launched with Id=6, I then wish to select a user from a dropdown. The idea was to use javascript and $.getJSON to fetch data for the specific user so as not to have to refresh the entire page. I use this approach in other parts of the app. The only difference I can see is with the URL in the browser. It would appear the presence of parameters via the '?' is futzing things up a bit.

View 1 Replies

AJAX :: ScriptResource.axd Is Being Invoked Several Times Per Each Aspx Page Request

Apr 1, 2010

I use ASP.NET Ajax in my web site and I am monitoring the HTTP requests per each page. I am surprised by the excessive call of ScriptResource.axd with different query string variables. I am pasting a sample of HTTP trace below. The call for ScriptResource.axd take lots time percentage out of total response time. Is this by design or there is something wrong with my AJAX configuration in web.config?


Actually it is degrading the performance of the application. And the user experience becoming very poor in case of lower bandwidth.

View 2 Replies

HttpContext.Current.Request.UserHostName Is Empty When Called From A Class

Apr 15, 2010

I have various web pages that need to build up a URL to display or place it in an emitted email message. The code I inherited had this value for the name of the webserver in a Public Const in a Public Class called FixedConstants. For example:

Public Const cdServerName As String = "WEBSERVERNAME"

Trying to improve on this, I wrote this:

Public Class UIFunction
Public Shared myhttpcontext As HttpContext
Public Shared Function cdWebServer() As String
Dim s As New StringBuilder("http://")
Dim h As String
h = String.Empty
h = Current.Request.ServerVariables("REMOTE_HOST").ToString()
Catch ex As Exception
Dim m As String
m = ex.Message.ToString() 'Ignore this should-not-occur thingy
End Try
If h = String.Empty Then
h = "SomeWebServer"
End If
Return s.ToString()
End Function

I've tried different things while debugging such as HttpContext.Current.Request.UserHostName and I always get an empty string which pumps out my default string "SomeWebServer". I know Request.UserHostName or Request.ServerVariables("REMOTE_HOST") works when invoked from a page but why does this return empty when invoked from a called method of a class file (i.e. UIFunction.vb)?

View 2 Replies

MVC :: Bug In 3 Beta Does Not Appear

Nov 5, 2010

I think there is a bug in ASP.NET MVC 3 Beta. This problem does not appear in previous releases of ASP.NET MVC.

If anyone wants to replay this error, he should follow this:

1. Download the latest mvc.

2. Create new ASP.NET MVC 3 Web Application

3. Applay Authorize attribute on About action in HomeController


4. Start application and invoke About action by clicking on About tab. You will get server error, because application is trying to redirect You to such [URL]There is obviously no Login view. There is LogOn view. Url to LogOn action is defined in untouched web.config:


View 1 Replies

BlockUI Alternatives For IE9 Beta?

Nov 1, 2010

BlockUI is throwing some exception when using its demos on IE9 beta.Meanwhile, does anyone know a similar feature in jQuery for showing a "Please wait" message when ASP.NET AJAX is processing?

View 1 Replies

WebMatrix :: Unable To Run .cshtml In Beta 3

Dec 2, 2010

After creating a Empty Template based website with a default .cshtml, I am unable to run the web page using webmatrix beta 3. Following error message I have : Server Error in '/' Application. Specified argument was out of the range of valid values. Parameter name: site Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: site Source Error:


Stack Trace:


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

View 1 Replies

Set Up Windows Authentication In WebMatrix Beta 2?

Oct 8, 2010

I have an ASP.NET site where authentication mode="Windows". Just downloaded WebMatrix beta 2 yesterday, trying to debug my app.

In WebMatrix, I'm getting 401 errors after pressing F5 in Visual Studio. Also in VS, getting "Unable to start debugging on the web server. An authentication error occurred while communication with the web server." When I click the help button, MSDN tells me I need to enable Windows authentication.

I don't see an option for authentication in WebMatrix.

More info (not sure if this applies). I've enabled SSL in WebMatrix. VS is set up to use a custom web server with the URL of https://localhost:44300/routing/development.aspx. In WebMatrix, the URL in the request view is https://localhost:44300/routing/development.aspx/debugattach.aspx (not sure where debugattach.aspx is coming from).

View 3 Replies

Unable To Install MVC 2 RC If VS 2010 Beta 2 Is Installed

Jan 26, 2010

i have vs 2k8 and vs 2010 beta 2 running side by side on a machine. i went to install mvc rc 2 today, and it errored saying the mvc was already installed.i went and looked at the release notes, and lo and behold, it says you can't install it if 2010 is installed.

View 3 Replies

MVC 3 Hangs When Open A New Project Using VS 2010 SP1 Beta?

Jan 17, 2011

ASP.NET MVC 3 was released on Jan 13, 2011. I was able to install it on my XP SP3 workstation. But, when I opened an MVC C# project, VS 2010 hangs. I have repaired VS 2010 and Framework 4.0 with no luck. The issue was resolved after uninstalling VS 2010 SP1 Beta. Does anyone know if ASP.NET MVC 3 works with VS 2010 SP1 Beta?

View 1 Replies

Visual Studio :: 2010 Beta 2 Installation?

Feb 1, 2010

I am working on Windows XP SP3 with VS 2008 Team System SP1. I installed VS 2010 Professional Beta 2. Although the installation reported a success, it also reported a failure of installation of Silverlight. I created a console applicaiton test project in 2010 and just tried to write Console.Writeline. But when I try to type "Console." it did not show me the intellisense. When I press "Ctrl+SpaceBar" it displays me the options correctly. Is there an issue with the installation or i have to change some options to enable intellisense.

View 2 Replies

To Install MVC 3 Beta Without Installing SQL Express And Visual Web Developer?

Nov 3, 2010

When I try to install the ASP.NET MVC 3 Beta on my server using WebPI, it wants to install Visual Web Developer Express 2010 and SQL Server 2008 Express R2 as prerequisites.I don't want either of those installed on my server. However, when I try to run the

standalone installer, I get the error "Microsoft ASP.NET MVC 3 does not apply", presumably because I don't have the prerequisites.Why is an IDE required to run ASP.NET MVC3? Are there manual or alternate ways to install the runtime only?

View 4 Replies

Visual Studio :: VS 2010 Version 10.0 Beta 1 & .NET MVC Versions.

Mar 5, 2010

I am using VS 2010 Version 10.0 beta 1 -and now i am studying ASP.Net MVC framework unleashed - stephen i would like to install MVC in my VS 2010 and work with the examples in the book....

I have downloaded ASP.NET MVC 2 RC 2 and also MVC 1 from ....i installed them alternatively trying with one another...they got installed perfectly....but i am not able to fing MVC template in the VS 2010 Beta 1...

I even tried...Web Platform Installer....but still no luck....I researched a lot in the web and here...and found this link...

it says...that i need to go back to VS 2008....but i dont really want to go back....I want to know the recent developments in this regard.

View 1 Replies

MVC :: MVC3 Beta Razor Views - Not Partial Classes?

Oct 12, 2010

Why are Razor views not generated as partial classes? Making them partial classes gives us the option to have a code behind where we can do some of the stuff we're forced to do in the template itself in the code behind file.

Yes, I know the standard "go-to" thing is Html helper but I don't want to use Html helpers for these things as they are too specific to the view in question and besides, having a clutter of extension methods is just not the way to go.

I'd like to see Razor views generated as partial classes.

View 4 Replies

MVC :: 3 Beta And Virtual Directory With Different Auth Methods Not Working

Oct 17, 2010

when I upgraded my root website from ASP.NET MVC 3 Preview 1 to the new Beta 1. I am using RavenDB, which needs to run as a virtual sub-application with Windows authentication instead of Forms authentication. I had raven working like described above just fine in preview 1, but with beta 1, now it won't work. It looks like no matter what I try, the membership provider system for my root website is redirecting me back to the login page, even though I've set my RavenDB virtual directory to use windows authentication and cleared out the membership and roles providers in it's web.config. I guess MS changed something to do with

either routing or authentication between preview 1 and beta 1. If anyone else sees this problem and knows how to fix it, I would be in your debt. I would guess that the easiest way to recreate the problem would be to create a new ASP.NET MVC 3 Beta 1 root website, then add a virtual directory marked as an application. See if you can get the root site to use the forms auth provided by default, but have the virtual directory use windows auth, denying all users but a specific one of your choosing. I can't seem to get this scenario working in the beta like I did in the preview.

View 3 Replies

Copyrights 2005-15, All rights reserved