Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Something similar to text /endtext in C#
Message
From
12/04/2016 21:57:06
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01634710
Message ID:
01634726
Views:
50
Likes (1)
>I put that string into text file and added it to the test project in the solution. Then I used this code
>
>
> String text = System.IO.File.ReadAllText(@"TestPictureString.txt");
>
>but got file not found exception.
>
>How should I get the full path of this file which is currently included into a solution? I don't want to put the actual directory from my machine, I want this to be more generic.
>
>Thanks in advance.

Good question. I haven't found any good answers to it.
I put those paths in the app.config file, create a string and use that to access the file.
When I move the app to another machine, I have to remember to change the app.config.

Here's how I access it.
string ftpoutputfilename = ConfigurationManager.AppSettings["FTPFilepath"] + "ftpfile.txt";
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform