All routes within my ASP.NET URL Routing web application are receiving a 404. However, the actual pages that exist are showing up correctly. I'm using IIS7. Any ideas?
All is good now. The main issue I had was that the HttpHandler for the UrlRouting was not added to the webServer section but rather the "old" handlers section.
Related
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.
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");
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.
I am using URL routing to make links to users profiles in asp.net, its work but the rest pages of the application not work , did i have to define a route for all pages or i miss something in somewhere.
I don't work with asp.net mvc but with asp.net web forms.
For profile page i want the routing but there is pages i just wont to use a asp x link to it
but all the pages now have the same URL defined in the routes in the global file.
I write this problem before two days always i have a problem.
You can debug your routes with ASP.NET MVC Routing Debugger Visualizer
or take a look at the blog of Phil Haack
We have a WCF service in our web application which is being called by browser through ajax(jquery and asp.net scriptmanager)
In this service some of the methods are WebGet and some of them are WebInvoke
Problem is now any request to WebInvoke method through asp.net scriptmanager is making request using http 'OPTIONS' instead of 'POST'. And webserver is going to deny this request as it don't allow OPTIONS
POST should be default for WebInvoke attribute when no method is defined.
We started having this problem since last couple of weeks just spotted today. We upgraded everything to .net 4.0 around same time so not sure .net 4.0 has something changed.
Also weird thing is everything works fine when using website like xyz.com we only see problem when using www.xyz.com
Any idea what it could be?
Edit: Ok got little closure
Problem is Asp.net scriptmanager does not allow cross site reference in ajax.
But wait we do not do anything that calls cross site.
What i found is when i use www.a.com some how js files generated by script manager wants to use a.com not www.a.com.
Any idea how to resolve this?
I have deployed my ASP.net MVC site to a shared hosting company. The problem is that now none of the pages except for the home page work. For example if I go to /Account/Register I get a page not found. However, if I go to /Account/Register/Index.aspx then it does work. I have tried modifying the routing to add in that index.aspx but everything I have tried fails.
Sounds like you need to either
1) have a wildcard mapping set up in IIS (don't know if thats an option)
2) or setup the routes to include the extension ("{controller}.mvc/{action}/{id}").
Either way have a look at this post by Phil Haack: ASP.NET MVC on IIS 6 Walkthrough
Ok, wierd problem I cant figure out. Hopefully someone where can. I have inherited a site that was developed with a very over-architected Content Management System. I am having problems now with the redirection functionality built into it.
This is on a dedicated Windows 2003 server running ASP.NET 3.5 sp 1. The redirects are stored in the database, and I have confirmed that the correct redirect is in place in the database. Finally, the file extension .html has been mapped in IIS to the ASP.NET ISAPI. And there is an HttpHandler created to redirect the .html requests. The default documents on the server, in order, are:
default.aspx
index.aspx
default.asp
index.asp
default.html
index.html
for this example, we have two redirects both pointing to the same content page. /example and /example.html
when requesting /example.html it correctly finds the appropriate redirect in the database and does its magic. Bueno. When requesting /example it gives a 404 page. Its not even the asp.net yellowish 404 generic error page. Its the standard vanilla IIS 404 response so it appears that asp.net is not intercepting these requests.
Let me know if any other information is requested and I will try to provide what I can. Thanks in advance for all the great recommendation I am sure will come from the community.
You should be able to map a wildcard extension to go through the ASP.Net ISAPI DLL is the solution.
Installing Wildcard Application Mappings (IIS 6.0) may also be useful.
Without rewriting the CMS, you can put a physical file in a new directory "/example". This will trigger ASP.NET to intercept the request, and hopefully load your page.
If you want to really hack it up you can change the IIS 404 page to be a .NET page in your application that can handle the original request and redirect to the page you really want.
Yes this is correct because /example is not pointing to any file, it is pointing to directory in the web server. Check that Default.aspx/ default.html or any other atleast one of them exists in your app.
If you are using ASP.Net MVC for REST then check your actions are properly written.