A set of technologies in .NET for building web applications and web services. Miscellaneous topics that do not fit into specific categories.
Hi Jay,
Based on your description and the responses you've received, the issue is that your MVC application is deployed as a sub-application under IIS (at /myApp/) rather than as the root site, but your routing and JavaScript aren't accounting for this application path.
Your JavaScript is constructing URLs that don't include the application directory path (/myApp/). When you access http://localhost/myApp/index.html, your JavaScript redirects to http://localhost/myAppLogin/Login, but it should redirect to http://localhost/myApp/myAppLogin/Login.
Here's how you can fix this:
Option 1: Fix the JavaScript
Update your JavaScript to include the application path:
var host = window.location.host;
var protocol = window.location.protocol;
var pathname = window.location.pathname;
// Extract the application path (e.g., "/myApp")
var appPath = pathname.substring(0, pathname.lastIndexOf('/'));
var url = protocol + "//" + host + appPath + "/myAppLogin/Login";
window.location.replace(url);
Option 2: Use Base Href
Add a base href to your index.html:
<head>
<base href="/myApp/" />
<!-- other head content -->
</head>
Then simplify your JavaScript:
window.location.replace("/myAppLogin/Login");
Option 3: Deploy as Root Site
Instead of deploying to C:\inetpub\wwwroot\myApp, deploy directly to C:\inetpub\wwwroot and configure your site as the root site rather than a sub-application.
Hope this helps.