Short and simple post for accessing Application base directory and wwwroot path in asp.net core 1.0.
This post is useful for newbie of asp.net core framework because many things changed from previous version of .Net framework.
IHostingEnvironment service to get both Application base directory and wwwroot.
Let's see code example for IHostingEnvironment service.
Hope you like it and keep reading for more!!
This post is useful for newbie of asp.net core framework because many things changed from previous version of .Net framework.
IHostingEnvironment service to get both Application base directory and wwwroot.
Let's see code example for IHostingEnvironment service.
private IHostingEnvironment _hostingEnvironment; public ValuesController(IHostingEnvironment hostingEnvironment) { _hostingEnvironment = hostingEnvironment; } // GET: api/values [HttpGet] public IEnumerable<string> Get() { // _hostingEnvironment.WebRootPath -- wwroot folder path // _hostingEnvironment.ContentRootPath -- Application Base Path return new string[] { _hostingEnvironment.WebRootPath, _hostingEnvironment.ContentRootPath }; }It's a simple and informative post regarding asp.net core 1.0.
Hope you like it and keep reading for more!!
This article is very useful. Great tips here. Your way is telling in this post is really very good. For more info:Techidemics
ReplyDelete