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


Similar Messages:

Web Forms :: Ignore Routes Using Wild Card Characters In URL Routing?

Sep 20, 2015

How to ignore route in ASP.NET vNext (MVC 6)?

Now I using the following routing config:

public void Configure(IApplicationBuilder app)
{
app.UseMvc();
app.UseMvc(routes =>
{
routes.MapRoute(
"Root",
"{*url}",
new { controller = "Root", action = "Root"}
);
});
}

The global root controller render a view in which I initialize AngularJS. It works for me, but I need to ignore routes for .css | .js | .*images_extensions* .

As I understood the following code doesn't work for this version of ASP.NET vNext:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

How I can make ignoring of a route?

View 1 Replies

Mvc Routing - Ignore Route With Extension In The Middle Of URL

Sep 6, 2010

i How can make the asp.net routing engine ignore routes with an extension of the type /pathtofile/filename.aspx/morepaths

I know this is hardly a real scenario but I need to know for another similar issue for an autogenerated url

View 1 Replies

Ignore Specific Error Messages In Global.asax?

Jan 17, 2011

In the global.asax file, I capture the error details (if one occurs) and I have it send that error detail to an email address.

I am finding that it's reporting all sorts of strange ones when the website gets hit with a crawler....or at least I think it is. ( HTTP_USER_AGENT: Mozilla/4.0 (compatible; Synapse)).

The following are common errors that repeat multiple times at the same date and time:

Error Message: Input string was not in a correct format.
Error Message: Invalid character in a Base-64 string.
Error Message: Unable to validate data.
Error Message: The serialized data is invalid.

View 3 Replies

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

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

Can Server .html Files Using Razor As If They Were .cshtml Files Without Changing The Extension Of All My Pages

Feb 24, 2011

I manage a large asp.net site which has previously been converted from static html site to asp.net. For several reasons (mainly SEO) we decided not to rename all the files to .aspx back when we originally converted the site. This was very easy to do by simply adding the buildProvider and httpHandler to the web.config.

<buildProviders>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
<httpHandlers>
<add path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>

Now I am upgrading the site to use Asp.net WebPages with Razor cshtml files. I can rename all the files if necessary, and use url rewriting to make the urls stay the same, however it would be much easier if I could just configure the web.config to tell it to parse .html files as if they were .cshtml. I have searched around quite a bit, and could not find anything equivalent to the PageHandlerFactory for razor pages. It appears as though it is just an internal mechanism in the .net 4.0 ISAPI handler.

The site is currently running on Windows 2003 server and IIS 6. We will be upgrading to 2008/IIS 7.5 in the near future, but I'd prefer not to wait for that. Is there any way to get the .html files to be parsed by razor as if they were .cshtml files?

View 2 Replies

Allow Specific Extension In Forms Authentication?

Mar 3, 2011

I am using forms authentication with

<authorization>
<deny users="?" />
</authorization>

However, I want to allow all calls made for specific extension say *.abc.

I tried:

<location path=".abc">
<system.web>
<authorization> [code]....

but wildcards are not allowed.How can I allow *.abc calls to work for all users?Is there any web.config element I can use OR anything I can do in AuthenticateRequest httpmodule?

View 1 Replies

Why Does IIS7 Ignore Content-type Header When Use Stream Files

Feb 9, 2010

I have a simple web site with two pages. One displays a list of files, and the other streams a file when it's clicked in the list. All was fine in production for 6 months, but now I have to move the site to Windows 2008/IIS7. I have it mostly working, but the files don't open properly (in Firefox) because my content-type header is being ignored. On the production site (IIS6) the headers are (using Fiddler):

HTTP/1.1 200 OK
Date: Tue, 09 Feb 2010 16:00:51 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename="myfile__foo.pdf"
Content-Length: 236841
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: -1
Content-Type: application/octet-stream

but on the test IIS7 server I get:

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 236841
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename="myfile__foo.pdf"

Fiddler also reports a protocol violation and says "Content-length mismatch: Response Header claimed 236841 bytes, but server sent 238378 bytes."

My code looks like this:

[code]....

View 1 Replies

Permanent Redirect Legacy Routes For Static Files In MVC?

Jan 12, 2011

Our old ASP.net site stored static images in a sub directory on the root called /images.

Our new ASP.net MVC site stores these images in the new layout of /Content/Images

I've changed all the pages in the site to cope with the new folder structure, but I'd like to set up Permanent Redirects from the old static images to the new location.

View 1 Replies

Configuration :: How To Prevent Specific Files Being Deleted From Temporary Files

Jun 2, 2010

The majority of files in the Temporary ASP.NET File folder for a given application get deleted by ASP.NET following compilation -- .DLL and .PDB files amongst others remain.

Our compiler produces proprietary debug information files which are amongst those that get deleted.

Marking the files read-only prevents this but are there other options available?

View 5 Replies

How To Get All Files Without File Extension Into An Array

Oct 26, 2010

How can i get all files without file extension into an array. I will supply the folder path.

Is this possible using Directory.GetFiles() or DirectoryInfo.GetFiles()?? Is there any alternative way?

I am using ASP.NET C#.

View 2 Replies

Using The .GetFiles Method To Return Files With More Than One Extension?

Jul 9, 2010

VWD 2008 Express. Visual Basic.

I am using the Directory.GetFiles method as follows:

[Code]....

As expected, it returns files with the ".pdf" extension. I would like to be able to specify more than one extension (like "*.doc*" and "*.txt*", etc.). How can I use GetFiles to return files with more than one desired extension, without returning all files?

View 2 Replies

Create Proper ICalendar Files With .ics Extension?

Feb 8, 2011

How can I create an icalendar file with minimum data, I try to make it as the following but somethings wrong,

when I try to import to my Google calendar, it says Events successfully imported but I cant see those event on my calendar

[Code]....

View 3 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

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

C# - Use Various Culture Specific Resource Files?

Oct 19, 2010

I have a website which currently uses EN-US and I also have resource file for french. what code should I need to write to make the application use the french version of the resource file.

The site is a commerce server and share point site that uses .NET

View 4 Replies

Automatically Downloading Files From A Specific Website?

Feb 8, 2011

I am a very new programmer.. A website is providing a lot of zip files that i needed. It will be updated/uploaded new zip files weekly. What I need to do is write a program/script to do auto downloading from the web weekly.. for example, this is the web link

http://www.google.com/googlebooks/uspto-patents-applications-yellowbook.html ( you can see a lot of zip files there )

so my question is What script i have to write(i got no experience in writing any script, so what can you suggest?) so i can download the zip file programmatically? then how should i make it to download the new zip file uploaded weekly?Is it i have to use DOM...unix? if yes, i will do some research on tat to make it work.

View 3 Replies

MVC :: How To Not Store Specific Page In Temporary Internet Files

Jul 3, 2010

I have a problem only in IE where my JQuery filetree cannot be refreshed unless the browser is closed, or temporary internet files is deleted via Tools -> Internet Options

Anyone know of a way so that this particular page never gets cached into temp internet files?

I've tried putting this in the header

[Code]....

As described here: [URL]

Nothing seems to work :

Preferably a solution for both IE8 and IE6 (yes i still have to support that goddamned browser)

View 2 Replies

Recommend Way To Create A Custom Culture And Associated Resource Files For A Specific Client

Oct 8, 2010

I have client that wants to specifiy their own version of localized content for a subset of my string resources.For simplicity here is basic example:Lets say I have 2 localized strings (showing english content)PageTitle="Hello World" PageDescription="This is a more wordy version of Hello World!"

Strings.resx (contains my English
string)
Strings.fr-ca.resx
(contains my French-Canadian strings)
Strings.fr-ca-clientX.resx (contains
[code]...

View 1 Replies

Java - An Application That Displays PDF Files In An IFrame At Specific Named Destinations?

Jun 18, 2010

We've got an application that displays PDF files in an IFrame at specific Named Destinations. This works well on Windows systems but not Mac. In Safari, with Acrobat, the Named Destination is ignored and the document is displayed at the start.

how we might accomplish the task of displaying this information? Our initial thoughts are to:

Convert the PDF to HTML on the fly and display the HTML version in the IFrame Convert the PDF on the page referenced to another format such as PNG etc. and display that in the IFrame Utilize some kind of Java app that allowed us to render the PDF while honouring the Named Destination (not sure if this exists)

Any other ideas on a potential method of better displaying PDF files at Named Destination points that is a little more cross platform?

EDIT: I guess another option is to store the data in XSL/XSLT type format and convert to HTML for veiwing or PDF for saving to the desktop.

View 1 Replies

Web Forms ::specific Privileges Required To Upload And Download Files From An ASP.Net Page?

Feb 28, 2011

What are specific privileges required to upload and download files from an ASP.Net page?I am using .Net 3.5 with IIS 7.0Prior to upload/download, how do I check whether specific folder has specific privileges to upload/download filesThis was so easy in classic ASP, but it seems too tricky in ASP.Net

View 1 Replies

How To Create A Common Web.config File And A Bunch Of Specific Web.config Files

Feb 16, 2011

Currently, I work on an ASP.NET project which is hosted under version control and is used on several developer machines, tester machine and production environment.

In three cases, configuration (Web.config) may be different. For example, developer and tester environments use testing SQL Server, whereas in production environment, another SQL Server is accessed, so the connection string is different in those cases.

We want to keep three versions of Web.config in subversion. But modifying each of three files every time we need to add, remove or change a common setting is annoying: it would be nice to have a common, master Web.config, which will be inherited by each of the three Web.config files.

How to set up an ASP.NET project which will use a master configuration file and different slave configuration files on different machines, thus sharing the same project/source code/configuration files in subversion?

View 2 Replies

MVC :: How To Ignore Template View

Mar 11, 2010

Say I have a DisplayTemplate called String.ascx and all string properties get rendered using this style, even if I don't have a UIHint attribute on the model class.

Now, I want a way to say..

'for this particular string property, don't use the template and render normally'.

I don't want to create another template with a default rendering.

So is there any [UIHint(Ignore)] or some such way?

View 2 Replies

JQuery :: How To Ignore The Textarea

Feb 9, 2011

I am tring to ignore the textbox error message that textbox mode is multiline .

Here code that ignore normal textbox

$('#aspnetForm input[type=text]').addClass('ignore');

what the code for textbox mode is multiline ?

View 6 Replies







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