Cody Hung
Cody Hung

Reputation: 17

How do I set root for an ASP.NET project B inside project A in IIS?

I have a separate asp.net MVC web project B which has to be placed inside project A (also asp.net mvc). I converted project B to application. I have a domain name for project A. So https://www.A.com points to root of project A. But then in project B, the root still points to https://www.A.com. For example, in project B, @Url.Action("Validate", "Login") renders https://www.A.com/Login/Validate. But I actually wanted https://www.A.com/B/Login/Validate. In other words, I would like the root of project B to be https://www.A.com/B, including javascript "/". How do I do that?

This is how the project set up in IIS.

IIS Settings

I hope I've explained my problem clearly. Thank you!

Upvotes: 0

Views: 65

Answers (1)

Jokies Ding
Jokies Ding

Reputation: 3494

By default, your application append application name in front of the relative path as long as you host project B as sub-application. It shouldn't make project B misunderstand the root folder.

Did you publish your application correctly?

Architecture:

enter image description here

Code:

enter image description here

Rendered html

enter image description here

enter image description here

Upvotes: 1

Related Questions