Sign Up

Sign Up to our social questions and Answers Engine 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 Engine 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

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7987639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:12:23+00:00 2026-06-04T12:12:23+00:00

In my MVC application I am trying to open a file for reading through

  • 0

In my MVC application I am trying to open a file for reading through StreamReader, the path the I’ve given to it is this, keeping the relative position of file from bin folder:

TextReader tr = new StreamReader("Content/files/text/email.txt");

But when I’m running it am getting this error over it:

Could not find a part of the path ‘C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\Content\files\text\email.txt.

This is very confusing as I don’t know to how to stop it to stop reading the path from the root directory but read it from application root folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:12:25+00:00Added an answer on June 4, 2026 at 12:12 pm

    You should do this, if you’re talking about winforms application.

    var tr = new StreamReader(Path.Combine(Application.StartupPath, @"Content\files\text\email.txt"));
    

    UPDATE:
    You don’t need StreamReader for a web application. It’s very simple:

    string text = new WebClient().DownloadString("URL_TO_WHEREEVER");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an ASP.NET MVC application and trying to use a RESX file to
I have this following mvc application The problem is when Im trying to assign
I'm trying to implement authentication in my MVC 3 web application via Google Open
I have a Spring MVC application trying to use a rich domain model, with
I'm trying to write an ASP.NET MVC application where user privilege is based upon
I am trying to implement URL Routing for a non MVC application. Here's my
I am trying to upload an ASP.NET MVC application in a shared server running
hi i am trying to create a custom attribute for my MVC application so
I'm trying to build a generic grid view in an ASP.NET MVC application. Let
I have a form within an ASP.NET MVC application and I'm trying to submit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.