Q:

MVC5 URL Mismatch works on localhost but not on remote machine

I have deployed an MVC Webapplication on IIS. It works fine from VisualStudio when i hit run (F5). The Url looks something like
Home page:
localhost:8080/
Second Page to be displayed when Data in entered and login button clicked[Just a simple form] -> localhost:8080/Data/Query/?fname=Markus&lname=Jennings
That was visual studio. Where the view is rendered perfectly and things work as expected. 
Now, when I access the  webapp from my browser by manually typing "localhost" the scenario is something like this: 
Home Page: 
localhost/website

Second page:
localhost/website/Data/Query/?fname=Markus&lname=Jennings

As you can see the website word/directory is always there. My application is published inside 
C:\inetpub\wwwroot\website So, I kinda understand why the website word is there. 
Data is my controller and Query is my action method.
Now comes the tricky part:
When I try to access my website using same machine but with different url (viz My IP number) the following happens
a.b.c.d/patinput 
Home page is rendered. 
After entering the data and hitting login, the URL that is displayed is: 
a.b.c.d/Data/Query/?fname=Markus&lname=Jennings

As you might have guessed the "website" directory is not present in the URL. According to me it should have looked like 
a.b.c.d/website/Data/Query/?fname=Markus&lname=Jennings

And if I manually add the website path/word, the second page is rendered as required. 
The first page is a simple login form where I take the first name and last name as inputs and call a javascript function. From the Javascript function i call my Controller (Data) with the parameters retrieved from the HTML page.
Inside the javascript function I am using 
window.location.href = '/Data/Query/?fname=' + fname + '&lname=' + lname;

I have tried addind a '.' before /Data/Query..... Doesn't work either. 
Thank you! 

A:

I solved this by a workaround. Looks something like this. 
In my javascript, I have saved the window.location.href value on the first hit. Used localStorage as 
localStorage.setItem("baseUrl", window.location.href);
and whenever i want to navigate to some other Actionresult i simply append it using this baseUrl

