Sign Up

Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Sorry, you do not have permission to add post.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Oraask Logo Oraask Logo
Sign InSign Up

Oraask

  • Write
    • Add A New Post
    • Ask A Question

Oraask Navigation

Search
Ask A Question

Mobile menu

Close
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Dev Tools
    • Online Compiler
    • Base64 Converter
  • Wiki
    • SQL Tutorials
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
Home/ Questions/Q 74884
Next
In Process

Oraask Latest Questions

Question
Aashish
  • 0
  • 0
AashishExplorer
Asked: September 8, 20212021-09-08T17:08:15+03:00 2021-09-08T17:08:15+03:00In: General Questions

How get wwwroot folder path from ASP.NET core

  • 0
  • 0

I want to get the  path of the wwwroot folder using the interfaces IHostingEnvironment  and IWebHostEnvironment.

.netquestion
2
  • 2 2 Answers
  • 3k Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    Related Questions

    • FailedAuthentication Fault Reason : FailedAuthentication : The security token cannot be authenticated
    • OBIEE 12c: External Embedded Content is Not Displayed (This content is blocked.)
    • What does & lt; and & gt; refer to?

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. Aashish
      Aashish Explorer
      2021-09-08T21:29:58+03:00Added an answer on September 8, 2021 at 9:29 pm
      This answer was edited.

      Any Help?

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. Walaa Mohamed
      Walaa Mohamed Junior
      2021-09-09T22:41:46+03:00Added an answer on September 9, 2021 at 10:41 pm

      Step 1:
      You will need to import the following namespace.
      using Microsoft.AspNetCore.Hosting;

      Step 2:
      By Using IHostingEnvironment
      public class HomeController : Controller
      {
      private IHostingEnvironment Environment;
      public HomeController(IHostingEnvironment _environment)
      {
      Environment = _environment;
      }
      public IActionResult Index()
      {
      string wwwPath = this.Environment.WebRootPath;
      string contentPath = this.Environment.ContentRootPath;
      return View();
      }
      }

      By Using IWebHostEnvironment
      In the below example, the IWebHostEnvironment is injected in the Controller and assigned to the private property Environment and later used to get the WebRootPath and ContentRootPath.
      public class HomeController : Controller
      {
      private IWebHostEnvironment Environment;
      public HomeController(IWebHostEnvironment _environment)
      {
      Environment = _environment;
      }
      public IActionResult Index()
      {
      string wwwPath = this.Environment.WebRootPath;
      string contentPath = this.Environment.ContentRootPath;
      return View();
      }
      }

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Adv 250x250

    Explore

    • Categories
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Dev Tools
      • Online Compiler
      • Base64 Converter
    • Wiki
      • SQL Tutorials
      • Java Tutorials
      • Python Tutorials
      • JavaScript Tutorials

    Footer

    Oraask

    About

    Oraask is a website for developers and software engineers who want to learn new skills, share their knowledge, and solve their coding problems. Oraask provides free content on various programming languages and topics, such as Oracle, Python, Java, etc. Oraask also allows users to ask questions and get answers from other members of the community.

    About Us

    • About Us
    • Contact Us

    Legal Stuff

    • Privacy Policy
    • Terms & Conditions

    Follow

    Oraask is licensed under CC BY-NC-SA 4.0Oraask CopyrightOraask CopyrightOraask CopyrightOraask Copyright

    © 2019 Oraask. All Rights Reserved
    With Love by Oraask.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.