https://github.com/ebyte23/usepathbase
UsePathBase for aspnetcore 1.0 and UsePathEnvironment()
https://github.com/ebyte23/usepathbase
Last synced: 8 months ago
JSON representation
UsePathBase for aspnetcore 1.0 and UsePathEnvironment()
- Host: GitHub
- URL: https://github.com/ebyte23/usepathbase
- Owner: eByte23
- License: apache-2.0
- Created: 2016-09-05T06:54:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-30T09:48:05.000Z (over 9 years ago)
- Last Synced: 2025-04-04T05:41:42.515Z (about 1 year ago)
- Language: C#
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UsePathBase
UsePathBase for aspnetcore 1.0 and UsePathEnvironment()
Thanks to Microsoft and community for original code.
This allows you to define sites pathbase in an environment variable and make it optional.
```
Linux
env ASPNETCORE_APPL_PATH=/app1
Windows
SET ASPNETCORE_APPL_PATH=/app1
```
```Install-Package ebyte23.UsePathBase```
You must put this at the top of your apps configure like so.
```
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
//This should be your first middleware
app.UsePathBaseEnvironment(true);
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
```