0

I am from a Classic ASP background and now trying to migrate into ASP.NET MVC. I am confused when I debug/deploy using IIS Express vs Local IIS.

For IIS Express when I first launch my web when I am at the tab Login.cshmtl in Visual Studio 2017. I will go to the following URL http://localhost:44300/

http://localhost:44300/

If I switch to Local IIS I will go to this URL http://localhost/BRO

http://localhost/BRO

With a BRO there, my subsequent routing will not work and all my glyphicons referencing are pointing at the wrong path. All other referencing is also not working

==========================================================================

Besides the font referencing, All other referencing will go haywire if the Login page fire-up with different URL

  ***I am not sure which url I will work***
        var url = 'Login' **This works when http://localhost:44300/Home/Login***
  ****
        var url = 'Home/Login' **This works when only http://localhost:44300***

  **In the http://localhost/BRO situation**

        var url= **I am not sure what will work here**

        var formData = $('#formLogin').serialize();

        $.ajax({

            url: url,
            type: "POST",

   ***Another anchor tag with href will reference wrongly*** 
   <a href="/Password/ForgotPassword" class="btn btn-link">Forgot password?</a>

===========================================================================

Web

Web

Solution Explorer

SE

IIS

IIS

How do I make the URL to be the same? Please help

10
  • How do you switch to Local IIS? How have you configured the virtual directory on local IIS? Commented Apr 11, 2019 at 5:38
  • @ChetanRanpariya All i can remember if switching the tab to Local IIS and then hit the Create Virtual Directory and there is a pop up and I click OK. Commented Apr 11, 2019 at 6:21
  • 1
    Ok... so in IIS, Default Web Site points to localhost and you have created another website inside it with name BRO that's why you see the URL as localhost/BRO. Commented Apr 11, 2019 at 6:30
  • With http://localhost/BRO what is the URL it is using to locate the fonts? Commented Apr 11, 2019 at 6:35
  • 1
    learn.microsoft.com/en-us/iis/get-started/… Back to IIS ABCs, learn what is a site and what is an application. Commented Apr 11, 2019 at 13:33

2 Answers 2

1

Thanks to @Chetan Ranpariya and @LexLi. I have figured it out that it is actually IIS.

After tweaking around I manage to have the following setting and everything works

At VS2017 Project Properties -> Web

LocalIIS

And clicking the run button

click

I get just localhost:

From VS2017

IIS settings

IIS1

IIS2

Bindings

When I click

Click

I also get

localhost2

The issue is when I hit create virtual directory, VS2017 actually created a sub site thingy under my Default Web Site, so I keep getting /BRO

Sign up to request clarification or add additional context in comments.

Comments

0

use this type url for glyphicons:

@font-face {
  font-family: 'Glyphicons Halflings';

  src: url('../fonts/glyphicons-halflings-regular.eot');

}

1 Comment

I think you can use url('~/fonts/glyphicons-halflings-regular.eot');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.