I have an ASP.NET MVC Route URL set to "/Services" which points to a controller action, but there is also a directory that contains my C# Services classes called "Services" which users cannot navigate to. This is causing issues with my route. It throws the following error:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Does anyone know how to overcome this?
Thank you
You would probably be best to not have this sort of clash but you can disable that feature by setting the RouteExistingFiles property on RouteCollection.
Related
Good day!
I'm writing a very simple asp mvc 4 app which is a simple static site.
When i send a request from the site to app - I get the following error on my first attempt:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for
(or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /EmailSendApp/login.aspx
On my second attempt, i click "send" and my app works well!
Why is it not working the first time?
Thank you!
It is Intranet site and i use Windows authorization.
It is ASP MVC application with Windows authorization.
In MVC application we cannot write .aspx extension in browser url.In mvc application viewpage extension is .cshtml so please remove .aspx extension in browser url.
Your requested url could be like this http:localhost/EmailSendApp/login
so your request is sent to login method which is present in EmailSendApp controller
I have not used the WebAPI for Web forms before but have inherited code that uses the WebAPI, so I apologise if this is a stupid question.
From the research I have undertaken today our setup seems fairly basic...
Route Table definition in global.asax
A Controller class that inherits from the ApiController
Ajax calls via jQuery
This all works fine locally and on product sites that do not have SSL certificates. However, the site has an SSL the ajax call produces a 404.
Any help would be greatly appreciated.
Thank You!
Rich
This worked for me:
Go to: IIS -> [your site] -> Handler Mappings
You need to make sure there is a Handler mapped to a path your web service is using, i.e. " */api/* ". In my project there was an existing handler called "Static File" with such a path. It used the StaticFileModule, DefaultDocumentModule, and DirectoryListingModule.
Under "Request Restrictions" set the rules that apply to your project. My settings:
Mapping
- Check "Invoke handler only if request is mapped to:"
- Mark "File or folder"
Verbs
- "All Verbs"
Access
- "Script" (default)
More info about Request Restrictions:
http://technet.microsoft.com/en-us/library/cc730969(v=ws.10).aspx
These settings can most likely be set in your site's Web.config. I'll post my findings when I get that working.
I would like to use routing to caching to client webbrowsers dynamic images generated.
I have created this routing code for .Net 4.0
routes.RouteExistingFiles = false;
routes.MapPageRoute("ImageWithLogo", "imageWithLogo/{Id}/{Width}/{Height}/image.jpg", "~/utils/imageWithLogo.aspx");
Trying this for example "imageWithLogo/1623/100/200/image.jpg" I always get the error Error HTTP 404.0 - Not Found, IIS always try to find the imageFile in web folder.
How can i make that IIS don't try to find the file in the web folders and always apply the routing?
Thanks
Sorry, I have find the solution in another Question in stackoverflow ASP.NET 4.0 URL Routing HTTP Error 404.0 - Not Found
I am currently having a strange issue that has taken me by surprise, I have not had the issue before and I have no idea why I am getting it now.
I have an asp.net mvc 3 website which has a number of controllers all with actions. It is important to note that this issue is only present with one controller and the problem is with all Actions.
The error I am getting is "HTTP Error 503. The service is unavailable."
However, this error only occurs if I browse to the page using the domain name, for example...
subdomain.example.com/controller
but everything works fine if I browse with the ip address and port number...
xxx.xxx.xxx.xxx:xxxxx/controller
remember all other controllers work fine regardless of the method used to browse.
I have tried looking for answers to this and trying to find any useful logging information but have found nothing of use. Hopefully somebody here will have seen this issue before
Ok I have created a sample mvc project with a Reports controller that works so I don't believe it is a problem with MVC.
I'd reccomend looking at your routes and your web.config and make sure you don't have anything intercepting it there into an httphandler or module. Then I'd look at the IIS instance and check for virtual directories. You pretty much are trying to figure out where exactly it is failing - is it even reaching ASP.Net?
One last option to look into is your company proxy - does going to the URL directly go through the proxy? I know at my company this can happen - so there may be a rule there that is intercepting it.
I'm trying to setup my umbraco site so that it does not use the .aspx extension. I made the necessary changes to the config files, but when I added the wilcard application mapping in IIS the homepage now comes back with an object reference error (at System.Web.UI.Control.ResolveClientUrl) if I try to access it from at the root (i.e. http://site.com/). The error doesn't occur if I add the default.aspx or if I browse to /home (the root node). Is there something else I need to setup to get the root node to run at the root url?
This is actually a problem with asp.net rather than merely umbraco - I found the answer on a DotNetNuke forum. The ResolveClientUrl function cannot handle a '/' URL. This was fixed by installing the latest service pack for asp.net 2.0.