TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
C# access a file
Sep 17 2012 2:38 PM
In a C# 2008 console application, I have a line of code that fails a try catch block.
The line of code is:
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
The wholse section of code looks like:
public Attachment AttIputDoc(String custId, String fileName)
{
Attachment att = new Attachment();
byte[] buffer = null;
try
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
catch (Exception e)
{
}
The line of code is trying to access a file that does not exist in a specific location.
Can you tell me how the code listed above knows where the directory path is for the file that needs to get uploaded at? The place it thinks the file needs to be loaded from is where the source code of where the application is acutally running from.
How would I override the default location so I can obtain the value from the app.config file?
Reply
Answers (
2
)
how to access FormView value in .cs file
multi control in single gridview cell