Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is a similar question to "How To Disable ASP.NET MVC Url routing" which hasn't been answered (I don't think the responders understood why it was needed).

I have an existing application that uses AngularJS and MVC url routing to serve the templates. I want to remove the MVC url routing as it is redundant (see comment below. we are using webApi to return data via ajax so the views/controllers are not needed).

I have removed the call to RegisterRoutes in the Global.asax.cs. There doesn't seem to be anything in the Web.config apart from a reference to System.Web.Routing so I left it.

I am using IIS Express with Visual Studio 2012.

When the application runs I get a 403.14 Forbidden error. I have enabled directory browsing. I have set the start page in the project in Visual Studio but I get a 404 despite the file definitely being there.

I have tried creating a non-mvc website and copying the contents of the web.config to my application, but this didn't work.

share|improve this question

2 Answers 2

if you mean by removing the .aspx on the end (www.something/home.aspx); In C#, instead of using

response.redirect("~/home.aspx");

use

server.transfer("~/home.aspx");
share|improve this answer
    
I'm using AngularJS which has it's own routing mechanism. I just want my existing application to behave like a normal asp.net (non-mvc) website without routing (i.e. localhost/index.html will serve the index.html page) –  Silverfox May 30 '13 at 9:33

AngularJs routing has nothing to do with ASP.Net MVC Routing.

Angular Routing:

Is used for deep-linking URLs to controllers and views (HTML partials). It watches $location.url() and tries to map the path to an existing route definition.

ASP.Net MVC Routing:

ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users.

In essence, AngularJs routing deals with client-side routing (using the location Url), whilst ASP.Net MVC deals with mapping http Urls to the appropriate controller/action in the server-side.

share|improve this answer
    
Yes I know. For example, in the routing config for an Angular module we have "templateUrl: 'Customer/edit'". Normally, this would be a static file, e.g. "templateUrl: 'CustomerEdit.html'". At the moment we have an MVC CustomerController that returns a partialview. I want to remove this as it is redundant. Basically, I want a project that was created as an MVC ASP.NET website to convert back into a regular ASP.NET website. I don't want to recreate the entire project from scratch. Thanks –  Silverfox May 30 '13 at 13:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.