简体   繁体   中英

ASP.NET/IIS equivalent of Java/WAS context-root

In Java on WebSphere Application Server if I want my servlets, etc., to start with a certain root path, I use the context-root property in the EAR deployment descriptor (application.xml). For example, my servlet is named GetData, but I want the URL to be www.mysite.com/secure/restricted/GetData, so I set the context-root to secure/restricted.

How do I do that in ASP.NET on IIS? Is the some kind of configuration setting for the application?

In.Net Core 2.0, there is an applicationUrl property in launchSettings.json:

By default, it will be "http://localhost:port/GetData" or "http://localhost:port"

Just change it to your final URL:

"http://localhost:port/secure/restricted/GetData"

One option would be Url Rewritting - http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

On the other hand, if you have your dynamic asp.net site separated from the rest of your content, you can add the folder secure/ and configure in there through the IIS Manager to point restricted to your asp.net site (regardless of where you have it stored).

That said, I don't know whether the WAS context-root give you something extra, for links to other info outside the asp.net site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM