MVC :: Routing Not Ignoring Files That Exist On Disk?
Feb 21, 2011
I am testing with an MVC 2 project generated by the template in VS 2010. I have simply added an ADO.NET Entity Data Model, as well as a WCF Data Service that leverages the data model.
I was able to access the web application content (views, as well as the data served by the data service) just fine until the day before yesterday.
Yesterday I decided to reinstall Windows 7 on my development laptop, and I chose to go with the release of the OS with SP1. Of course, I reinstalled Visual Studio as well.
Now the same project gives me HTTP 404 errors when I try to browse to the data url .../MyTodoDataService.svc).
Here are some interesting facts:
The same data service works just fine in a Web Forms application. I see the problem only when deploying to the Local IIS Web Server (Cassini runs it just fine).
I am able to browse to the data url if force MVC routing to ignore the appropriate route by calling "IgnoreRoute" on the RouteCollection in Global.asax.
View 7 Replies
Similar Messages:
Oct 11, 2010
I'm populating a generic list from an excel file that contains names of pdf files. Now I want to take each item in the list and create a file from it. Here's what I have so far:
[Code]....
So now, the list called lines contains names of 900 pdf files. How would I take those names out of the list and create files from them?
View 1 Replies
Dec 17, 2010
which component in MVC pattern is responsible for writing files to disk? Is this a controller or model?
View 2 Replies
Oct 14, 2010
I have an app configured to use anonymous authentication, the application pool is set to network service. When I run filemonitor I can see that thw w3wp.exe is picking out the webpages and stuff from my hard drive and returning images etc. However one of the pages saves a file to a folder using c# save() method. Instead of the w3wp.exe actually writing the file to disk explorer.exe seems to be accessing the folder. What the hell is going on? I though the w3wp.exe did everything asp.net related why on earth is explorer.exe being introduced into the fold here?
View 1 Replies
Jul 14, 2012
I want to upload .pdf or .doc files on server not in the Database, after then i have to show list of all the uploaded Files on another form and when user clicks on one of the Files, the file should be opened in new Tab...
View 1 Replies
Aug 29, 2013
I am working on a journal website where user submit manuscripts , pdf files , is it good idea to store pdf files on directory or on database.
View 1 Replies
Sep 15, 2010
I have two tables:
Table1
IDTable1
CustomerName
Table2
IDTable2
IDTable1
FIlePath
There is a one to many relationship with key field = IDTable1
I have created one client and uploaded 20 files
Now I would like to:
Delete the client record from Table1
Delete all associated records in Table2
Delete all files from the disk based on the paths in Table2
I am able to delete all the records in both tables but I cannot delete the disk files. Here is what I ahve so far:
[Code]....
View 1 Replies
Oct 12, 2012
I am developing audio related project for that i have stored movie names with mp3 file paths in database I am displaying movie names in grid view after clicking on movie name related mp3 file paths will be display in details view i am unable to play that files in details view how to do this ? Here i am storing original mp3 files in one folder in solution explorer and paths in database
View 1 Replies
Aug 18, 2010
I need to setup a file handler to route with multiple sub directories something like tihs;
http://localhost/images/7/99/786936215595.jpg
I tried putting this in the global.asax file;
routes.Add(
"ImageRoute",
new Route("covers/{filepath}/{filename}",
new ImageRouteHandler()));
I am using the ImageHandler found in this Question, which works great if you have a single sub-directory (ie '/images/15/786936215595.jpg') but fails when you have multiple directories.
I tried setting up a wildcard and that didnt work (ie 'new Route("covers/{filepath}/*/{filename}"')
This is serving images from a large NAS (think something like 3 million images) so its not like I can just move files around.
View 2 Replies
Dec 22, 2010
I am using URL Routing in Asp.net 4. I have successfully got the url routing working, however i have encountered a problem with my web pages trying to access local files. For e.g. before i started using URL Routing, my web page was called [URL]. In this page i was making references to a CSS file and some Js files. They were referenced as follows : <link href="CSS/mycss.css" rel="stylesheet" type="text/css" /> and <script src="js/myjs.js" type="text/javascript"></script>. So basically i have two folders sitting on the route, called CSS and JS, containing the respective files.
However, after implementing routing my url has now become e.g. [URL] This is fine, but what has now happened is that my CSS and JS have become inaccessible as they are now referenced as follows: [url] or [url] i know i can sort of resolve this by referencing my files as follows
<link href="../../../CSS/mycss.css" rel="stylesheet" type="text/css" />
and <script src="../../../js/myjs.js" type="text/javascript"></script>.
But that means i have to change the path for every reference, and i have too many. Then also i must change the references to any background images for instance in my css to have the same path. This is a huge nuisance, and pain in the back side. Does anybody know of a solution for this, where i will not need to change the referencing for the files.
View 6 Replies
Jan 22, 2010
I'm using the System.Web.Routing.UrlRoutingModule.
With that I'm writing:
routes.Add(new Route(@"cart/add", new RouteHandler("~/Order/CartAdd.ashx")));
routes.Add(new Route(@"cart/delete", new RouteHandler("~/Order/CartDelete.ashx")));
And I also have one route called:
routes.Add(new Route(@"{*url}", new RouteHandler("~/Error/PageNotFound.ashx")));
But if I go directy to /Order/CartAdd.ashx I never enter the routing. It goes directly to that handler. And if I go to /Order/ I get a 403.14 error.
How do I instead catch those urls with the routing?
View 1 Replies
Jan 13, 2011
I have a directoty containing some files , so if I run the code
[Code]....
If I create new Files on the same folder DirTEST or update contains of the files , CreationTime and
LastWriteTime works correctly But if I copy and Paste the same files on the folder DirTEST ( crush or run over files) , CreationTime and LastWriteTime does not change
How can we get datetime of pasting files (already exist)
View 1 Replies
Jun 24, 2010
I am using URL routing in asp.net application (not MVC) . I have Admin folder in my aaplication which has admin related aspx pages with seperate web.config. I have seperate login form for admin users which is placed in admin folder itself. My issue is whenever I hit [URL] (which I want to go to login form for admin)- it tries to authenticate and goes to login url mentioned in web.config of root folder.
Note: Admin folder has anonymous access in root config file. Also I have set default document in config of Admin folder. I have added following line in global.asax so that routing doesnt work for files in admin folder;
routes.Add(new
Route("admin/{*resource}",
new
StopRoutingHandler()));
I am really confused what is the issue? What I am missing?
View 6 Replies
Sep 29, 2010
I have spent a day and a half trying to resolve this issue. Bascially have an ASP.net website with Forms Authentication on IIS7 using Framework 4.0.
The Authorization stuff seems to be working perfectly for every scenario with the exception of hitting it with no document specifed (Should resolve to Default Doc).
For example [URL] works perfectly, this page should allow anon access as specified in the web.config.
but if I hit [URL] Directly it redirects to the login page with Return URL set to "/" or Login.aspx?ReturnUrl=%2f
Some things I have tried:
1) Set Authentication to None and then the Default document worked so thats not the issue.
2) Added DefaultDocument attribute to Web.config
3) Deleted all entries for in Default Document list in IIS except for Default.aspx
4) Added MachineKey entry in Config
5) Toggled from Integrated to Classic pipeline in IIS
Here is what's in my config:
[code]...
View 6 Replies
Jul 15, 2010
I've got the following scenario:
one object datasource configured with a storedprocedure that has PROCEDURE [dbo].[GetContractsPaged] ( @startRowIndex int, @maximumRows int )
but later I realized that I needed an extraparameter so first I tried to add an extra parameter as a filter like:
<asp:ObjectDataSource ID="odsContrato" runat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetContractsPaged" EnablePaging="True" TypeName="Facturacion.DAL.ContratoDataLayer" UpdateMethod="Update" SelectCountMethod="TotalNumberOfContratos"
FilterExpression="emprnume ='{0}'">
<FilterParameters>
<asp:SessionParameter Name="emprnume" SessionField="emprnume" Type="String" />
</FilterParameters>
Which worked fine but with one problem... apparently selectcount method is ignoring filter parameter and is returning the full set of data. Surfing the net I found that select parameters when used are also taken by seleccount method... the problem is that when I used:
<SelectParameters>
<asp:SessionParameter
Name="emprnume"
SessionField="emprnume"
Type="String"
/>
</SelectParameters>
Inmediately, I received the error : ObjectDataSource 'odsContrato' could not find a non-generic method 'GetContractsPaged' that has parameters: emprnume, maximumRows, startRowIndex.
So I decided to modify my stored procedure to receive an additional parameter and modify my class to reflect the change but when trying to use it I kept on receiving the same error I showed above in bold.
View 10 Replies
Jul 20, 2010
I tried everything I could find, but still does not work on IIS routing.
View 2 Replies
Mar 22, 2010
I have problem with displayed html code in crystal reports. I use Crystal reports 2008 version 12.0.0.549 My report ignore more html tags(table, ul-li...). My html code is from db.
View 2 Replies
Nov 15, 2010
I've written my own staticsitemapprovider which builds a dynamic site map. The problem I have is that sometimes pages will have additional parameters in the query string which I need to ignore. Public Overrides Function FindSiteMapNode(ByVal rawUrl As String) As SiteMapNode
Dim startpos As Integer = 0
Dim endpos As Integer = 0
If rawUrl.Contains("pagetype=") Then
startpos = rawUrl.IndexOf("pagetype=")
endpos = rawUrl.IndexOf("&", startpos) + 1
[code]...
View 1 Replies
Dec 12, 2010
I am using:
ASP.NET 3.5 SP1 with Web Forms Routing thru Global.asax (System.Web.Routing and RegisterRoutes)IIS 7
Everything is working fine in my local machine, but it gives the following error in my hosting environment:
Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I did everything inside my web.config file mentioned in the following link:
[URL]
But I am still getting the above error.
What else am I supposed to do fix the error?
View 1 Replies
Sep 9, 2010
My website is allowing the web.config file to be downloaded. However in my C:WINDOWSMicrosoft.NETFrameworkv2.0.50727CONFIGweb.config file I have this line
<add
path="*.config" verb="*" type="System.Web.HttpForbiddenHandler" validate="true"/>
Which should mean any config file can't be downloaded.
View 1 Replies
Feb 22, 2011
I have a Web application where i have added a reference to a RESTful WCF. I got the WCF url Routing to work in my webapplication by adding Inherits="RestService.Global" to the Web applications Global.asax.
<%@ Application Codebehind="Global.asax.cs" Inherits="RestService.Global" Language="C#" %>
But then i tried to create url Routing for the Web application and it does not work with the Inherits="RestService.Global" in the Global.asax. If i take it away it works fine. Is there a correct way to do this.
View 1 Replies
Jan 31, 2011
I'm trying to create my own CMS and I've gotten a little bit stuck at the stage of URL routing.
I want clean URLs without extensions and I'd like to be able to create and modify them in a web based interface without any messing around with IIS or actual files.
I've seen how to create a static route, but for that I need to go into my Global.asax file and manually add it.I would like to have all of these routes stored in a database so that I can easily modify them later.
Does anyone know how this can be achieved?
Just for extra information, I will be attempting to create a feature so that if a path exists, but is later changed, a 301 redirect is created to the new URL, is this also possible? (My first problem is the main issue, but thought I might ask this as well just in case it makes a difference)
View 2 Replies
Sep 2, 2010
How to handle asp.net mvc routing along with asp.net webform routing. I have merged my mvc app into my existing web application. In my web application i have implement routing as below:
routes.Add("View Product Details", new Route("Product/{City}/{Manufacturer}/{Name}/{ProductID}/{*ProductType}"));
Similarly i have implemented routing in mvc as below
routes.MapRoute("Product Details",
"Product/{City}/{Manufacturer}/{Name}/{ProductID}/{ProductType}",
new
{
controller = "Home",
action = "ProductDetails",
City= UrlParameter.Optional,
Manufacturer= UrlParameter.Optional,
Name= UrlParameter.Optional,
ProductID= UrlParameter.Optional,
ProductType= UrlParameter.Optional
});
How to handle both pages, as one is custom web form while other is asp.net mvc view?
View 1 Replies
Jun 7, 2010
I have a page that I am adding user controls to the bottom of the controls each postback. The User Control has a textbox in it and the focus needs to be on this newly created control textbox each time. It all works almost perfectly however when there are too many controls to fit on the page, because I set the focus to the textbox the bottom of the page is set to the textbox that has focus not the very bottom of the page. I have a submit button below this which ends up below the page limit. How can I set focus to a textbox but still scroll to the every bottom of the page to show the submit button.
View 1 Replies
Jul 2, 2010
I have a C# web forms ASP.NET 4.0 web application that uses Routing for URLs for some reason custom errors defined in the system.web section of my web.config is entirely ignored and it will fall back the IIS errors.
This gets entirely ignored
[code]....
This would be a minor inconvenience except that by the fact it falls back to IIS native instead of my application it completely circumvents Elmah logging my 404 exceptions correctly.
View 3 Replies