Caching - Removing Specific Routes From RoutesTable?

Oct 19, 2010

my site has many many routes. since the users can add or remove pages at will, i need a way to reregister the routes from time to time

at reregister i do not want to clear the whole route cache ("RouteTable.Routes.Clear"), but i would rather go thru the table route by route, and using a certain regex on its name, decide if to remove it or not.

after that i will reregister the specific pages that i need to

heres my code meanwhile

For Each r In RouteTable.Routes
If CType(r, Route).DataTokens("ConfigID") = ConfigID Then RouteTable.Routes.Remove(r)
Next

after the first remove it throws an error "Collection was modified; enumeration operation may not execute."

View 1 Replies


Similar Messages:

Web Forms :: Removing Specific Routes From RoutesTable?

Nov 1, 2010

ive asked this question [URL] but have not yet recieved a workable solution

the problem is that i need to remove only specific routes from the routetable and then add them back (with some changes). I do not want to clear the whole collection.

heres my code

[Code]....

the problem is, as soon as the first route is removed, the following error is thrown:

Collection was modified; enumeration operation may not execute

so how can i get around this error? or is there a better way to remove routes?

View 2 Replies

C# - Ignore Routes For Files With Specific Extension?

Jul 12, 2010

I want to remove any mapped routes for files with a certain file extension.

RouteTable.Routes.Ignore("{root}.hello");

Works for any file that has the extension .hello in the root directory, however as soon as i go into any subfolders the 'ignore' rule isn't applied.

Ive tried lots of different combination's, but can't seem to get one that doesn't throw a compiler exception, or not work?

View 2 Replies

Removing HttpModule For Specific Path In IIS 7 Application?

Jun 16, 2010

Most succinctly, my question is whether an ASP.NET 4.0 app running under IIS 7 integrated mode should be able to honor this portion of my Web.config file:

<location path="auth/windows">
<system.webServer>
<modules>
<remove name="FormsAuthentication"/>
</modules>
</system.webServer>
</location>

I'm experimenting with mixed mode authentication (Windows and Forms - I know there are other questions on S.O. about the topic). Using IIS Manager, I've disabled Anonymous authentication to auth/windows/winauth.aspx, which is within the location path above. I have Failed Request Tracing set up to trace various HTTP status codes, including 302s.

When I request the winauth.aspx page, a 302 HTTP status code is returned. If I look at the request trace, I can see that a 401 (unauthorized) was originally generated by the AnonymousAuthenticationModule. However, the FormsAuthenticationModule converts that to a 302, which is what the browser sees. So it seems as though my attempt to remove that module from the pipeline for pages in that path isn't working. But I'm not seeing any complaints anywhere (event viewer, yellow pages of death, etc.) that would indicate it's an invalid configuration. I want the 401 returned to the browser, which presumably would include an appropriate WWW-Authenticate header.

A few other points: a) I do have <authentication mode="Forms"> in my Web.config, and that is what the 302 redirects to; b) I got the "name" of the module I'm trying to remove from the inetservconfigapplicationHost.config file; c) I have this element in my Web.config file: <modules runAllManagedModulesForAllRequests="false">.

View 1 Replies

MVC :: Routes.IgnoreRoute Not Ignoring Routes?

May 25, 2010

I'm trying to prevent direct file requests from being accepted, and have tried this:

[Code]....

None of these worked. I want the rule to exclude any file of any filename in any directory with a matching extension. How can this be done?

View 11 Replies

C# - Implement System.Web.Caching.Cache Object In A Controller To Cache Specific Query?

Mar 29, 2010

Is it correct to implement my caching object like this in my controller :

[code]....

And I Use it like this :

[code]....

View 1 Replies

How To Mix DynamicData Routes With Mvc Routes

Jan 9, 2011

I am trying to create an Area for running DynamicData with scaffolding as an administration part. It's probably working as it should but I can't get the routing to work.

In my global.asax I have the following function to register the routes:

[Code]....

Unfortunately the "best" thing that happened to me so far was that when I check the default tables I get a message about (MetaModel.VisibleTables)

[Code]....

The problem is that I don't know why this is. Is it the routing or something else? Is it perhaps some security thing or can I not put dynamic data inside an area?

The DynamicData folder itself is located in the root of the application since that is the convention it uses and I have no intention to override that.

View 1 Replies

Configuration :: Removing Login Account Without Removing User?

May 31, 2010

Long ago, I created an ASPNET user for development use.However, every time I boot up my dev system, I'm presented with a user login for ASPNET, among others.I don't want to remove ASPNET; I need it for dev work.But how do I keep it from appearing among the list of User Logins available at boot-up?

View 4 Replies

State Management :: Partial Page Caching (user Control Caching) And Button Events?

Jun 14, 2010

I have a page with a number of user controls, In one of my user controls I have a button event. I turn on output cache for the user control that has the button and vary by control using the ID property of a hidden field control in the user control. whenever I turn on the output cache my button event doesn't fire.

View 2 Replies

WCF / ASMX :: Implement Caching Using System.Web.Caching?

May 15, 2010

how to implement caching in wcf service using System.Web.Caching

View 2 Replies

Security :: Associate A Specific User To A Specific Data On The Site?

Mar 14, 2010

I am trying to figure out how to associate a specific user to a specific data on the site, like social networking site.

View 3 Replies

MVC :: 2.0 Messing Up Routes In ARR 2.0

Dec 28, 2010

I have a server that has been using ARR 2.0 on IIS 7. I recently added MVC 2.0 to my ASP.NET site. After adding it the ARR routes return the following error: The virtual path 'null' maps to another application, which is not allowed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: The virtual path 'null' maps to another application, which is not allowed. Source Error:

[Code]....

Stack Trace:

[Code]....

In my web.config I can remove the modules attribute runAllManagedModulesForAllRequests and the ARR works, but it makes the MVC routes stop working.

View 2 Replies

MVC :: Routes Error In 2 RTM

Apr 3, 2010

I created an MVC 2 RTM Project and created 2 Areas (Admin and Applicants) The code belows was added into the global.asax: AreaRegistration.RegisterAllAreas(); I also ensured that duplicate Controllers were managed as i have a homecontroller in the root and the Admin Area. The code used was; new string [] {"MyAppName.Controllers"} This too went into the global.asax The error i got is below; A route named 'Applicants_default is already in the route collection. Route names must be unique. Parameter name: name how to resolve this?

View 6 Replies

MVC :: ViewBag And Routes (3 - RC2)

Dec 18, 2010

I am having an issue with MVC-3 generating outgoing routes for me. This is the address of the page I am on for both scenarios: [URL] Here are the map routes:

[Code]....

Scenario 1:
From the controller:
[Code]....
From the view:
[Code]....

The resulting link that gets created. [URL] If I change the controller code to read as follows:

[Code]....

I didn't make any changes in the view, only added those two lines to the controller and the following link is created: [URL] What am I missing here? This is consistent behavior, I was able to reproduce this in other areas of my application.

View 4 Replies

Web Forms :: How To Call Specific Code In Specific Time

Jun 7, 2010

I have function named (display)

I need to call this function (display) avery two second

View 4 Replies

MVC :: How To Show ViewData In Specific ContentPlaceHolder In Specific MasterPage

Feb 1, 2010

This is my Controller Action which takes a Page entity from database and shows it in the Show.aspx view using the "Site.Master" master page:

[Code]....

This is the "Show" view rendering "Page.Title" in the "MainContent" content placeholder:

[Code]....

And this is the "Site.Master"

[Code]....

Using this approach i can show "Page.Title" in Show.aspx using any master page that has a "MainContent" placeholder, but my real goal is if i can when i choose the MasterPage for that particular Page to also see a list of available ContentPlaceHolders and when i choose one to then render "Page.Title" in that particular ContentPlaceHolder.

View 4 Replies

Delete Specific Records From Specific Table Randomly

Dec 18, 2013

My application for "Members subscriptions registration" working online and different users using it.

Database type is Mssql Server 2008 R2, Size is around 1 Gb

What happen exactly there is specific record delete from table "Members" in random times, For example I add 100 new subscriptions with around 800 records and make confirm and checking next day find it loss 3 records find it deleted.

I checked all the applications no any delete query, I removed all delete query from application to make sure no any delete also I save any delete query happen in system inside table for log.

View 2 Replies

C# - Routes With Multiple Arguments In MVC 3?

Jan 19, 2011

I am trying to set up dynamic routes in an MVC app, and I have this so far...

[Code]....

And that is working great for now, the only issue I am having is that I would like to have the ability to specify a comma delimited list of optional arguments in the database that I could pull out like...

Array optParams = rdr["parametersOpt"].ToString().Split(',');

But I was not sure how to stick those params into the route object properly. Could just be a minor C# syntax I am not familiar with.

View 2 Replies

MVC :: How To Organize More Complex Routes

Mar 12, 2011

I understand the basics of setting up routes, I am trying to get a handle on how to organize more complex routes. Does the Route name do anything? I havn't seen a place it's actually used. If I have the route: controller/action/id/paramA/paramB/paramC. ParamA-C could be defining multiple parameters so First/Last/Zip or Phone/Zip/Birthday. Is it common practice to name the additional parameters with a generic name like paramA vs trying to differentiate a separate route for each?

Lastly, if you have multiple sites/functional areas in 1 site, lets say the asp.net site, each area MVC, Ajax, Forums ect were all different functional areas. Is it best to create a different group of routes such as hard coding the controller like:

MVC/action/id
Ajax/action/id
Forums/action/id

or is there a better way? What I am running into is 1 piece of the site overriding the other route because of the number/type of parameters.

View 5 Replies

MVC :: Database Localization Url Routes With 2?

Jan 19, 2011

I been looking for hours on the web to find a good tutorial where I can do a database localization with mvc 2, I can't find any its all resource files. So I'm trying to reach out to you guys and see if you got any links, books or suggestions on this topic? I would love for it to be url routes based localization but that I can figure out somehow i think.

View 10 Replies

MVC :: Custom Routes For 5 Different ActionResult()?

Apr 6, 2010

I'm creating a new ASP.NET MVC 2.0 web application that will have 5 main pages:


- Home
- Services
- Contact Us
- Terms & Conditions
- Priva

View 2 Replies

MVC :: Adding Routes - Best Practices?

Jul 4, 2010

We are working on a project which has lots of routes that can be changed on-the-fly or new routes can be added dynamically. What are the best practices about managing lots of routes and adding routes on-the-fly without recompiling? Reading-Writing from-to database or from Xml Document in Application_Start?

View 4 Replies

MVC :: Modify The Routes Dictionary?

Feb 16, 2010

how to do routing. My problem basically relates to "logged in" and "logged out routes" and having both as "/".

i.e. I have home/index for logged out user which appears as "/" but this has got me confused as to how I can have home/home for logged in user and still have "/".

I keep getting 127.0.0.1/home/home

I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/index.

how I can modify the routes dictionary (which will be binded ONCE at the start) so that the "/" can be shared for logged and non-logged users ?

View 8 Replies

MVC :: Subfolders In The Views And Routes

Mar 21, 2011

I'm looking to add more organization to my Views folder by adding subfolders to the existing structure.

Views

Configuration

Controller

View View
Controller

View

Controller

View
Controller

View

So in order to add the "Configuration" subfolder, I attempted to add a route to the routetable:

[Code]....

This results in a 404 error.

All of the similar posts I've seen on this site and the web have to do with adding "areas" which don't seem to be applicable in the MVC3 arena.

View 2 Replies

C# - Get Url From RouteTable.Routes Collection By Key?

Oct 14, 2010

How to get url from RouteTable.Routes collection by key?

View 2 Replies







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