
Can ASP.NET and HTML Run in the Same Directory?
Yes, both ASP.NET applications and HTML websites can coexist within the same directory structure on Windows hosting. By default, IIS (Internet Information Services) supports multiple file types, meaning static HTML files (.html
, .htm
) and dynamic ASP.NET files (.aspx
, .cshtml
) can be stored in the same folder and served without conflict.
When a visitor requests a page:
- If the request is for a .html file, IIS will treat it as a static page and serve it directly.
- If the request is for an .aspx file, the request is handled by the ASP.NET runtime.
This ensures seamless integration, as long as your directory structure and permissions are correctly configured.
Steps to Configure ASP.NET and HTML in the Same Directory on Plesk
1. Prepare Your Hosting Environment
Log in to your Plesk control panel. Make sure your hosting plan supports ASP.NET. On most Windows hosting packages, ASP.NET is pre-installed, but you should confirm which versions are available (ASP.NET 4.8, .NET Core, etc.).
2. Upload Your Files
Upload both your HTML files (for example, index.html
, about.html
) and your ASP.NET files (for example, default.aspx
, web.config
) into the same directory, usually the root folder of your domain (httpdocs
in Plesk).
3. Manage Default Documents
By default, IIS may load default.aspx
before index.html
. If you want your static HTML page to load first, you can change the Default Document Priority in Plesk:
- Go to Plesk > Hosting Settings > Default Documents.
- Reorder them so that
index.html
appears beforedefault.aspx
.
This ensures your HTML homepage is prioritized, while ASP.NET still functions for application-driven pages.
4. Configure Web.config Properly
The web.config file is essential for ASP.NET applications. If your directory contains both static HTML and ASP.NET files, make sure the web.config
does not restrict access to .html
files. A common issue arises if URL rewriting or authentication rules are too strict.
For example, allow HTML files by adding:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".html" mimeType="text/html" />
</staticContent>
</system.webServer>
This ensures IIS properly serves .html
files without redirecting or blocking them.
Common Issues and Fixes
- 500 Internal Server Error: Often caused by incorrect
web.config
rules. Check error logs in Plesk and remove conflicting modules. - HTML not loading: If
index.html
doesn’t load, ensure it is listed in the Default Documents order. - ASP.NET runtime errors: Make sure the correct .NET version is selected in Plesk > ASP.NET Settings.
- SSL certificate mismatch: If you face SMTP or CN issues, verify your SSL setup for subdomains like
mail.domain.com
vs.smtp.domain.com
.
Conclusion
Running an ASP.NET website and an HTML website in the same directory on Windows hosting with Plesk is completely possible and, in many cases, the most efficient approach. With proper configuration of default documents, web.config, and permissions, you can combine the power of ASP.NET dynamic applications with the speed and SEO benefits of HTML static content.