Dots in url causes 404 with asp net mvc and iis


ASP.NET is a popular programming language used for building web applications. However, sometimes developers may encounter with URLs that contain dots, resulting in a 404 error. This article aims to a solution to this problem by explaining the cause and offering examples of how to it.

The Problem

When using ASP.NET MVC with IIS, URLs that contain dots can cause a 404 error. This is because IIS interprets dots in the URL as file extensions and tries to find a file on the server. If no file is found, it returns a 404 error.

The Solution

To solve this issue, we need to configure IIS to allow dots in the URL without interpreting them as file extensions. This can be achieved by modifying the web.config file of your ASP.NET MVC application.

Modifying the web.config File

To modify the web.config file, open it in a text editor and locate the section. If it doesn't exist, you can add it within the element.


In the above , we are removing the UrlRoutingModule and it back again. This ensures that the routing module is executed for all , including those with dots in the URL.

Handling Dots in URLs

Once the web.config file is modified, you can handle URLs with dots in your ASP.NET MVC application. Let's consider an example where we have a controller named HomeController with an action method called About.

 class HomeController : Controller
    public  About()
        return View();

In the above code snippet, the About action method returns a view. To access this action method, we can use the following URL:

However, if we want to include a dot in the URL, such as, we would encounter a 404 error before modifying the web.config file.

After modifying the web.config file, the URL with a dot will work correctly, and the About action method will be executed as expected.


By modifying the web.config file and configuring IIS to allow dots in URLs, we can solve the issue of 404 errors when using ASP.NET MVC with IIS. This allows developers to handle URLs with dots and ensures smooth within their web applications.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents