0

This:

string sFile = @"E:\Proyect\Beta\websiges\files\temp\" + nameDoc() + tipeDoc;

This url reads an image , but do not want to have the url with the "E " direction as it is a web project and urls must be dynamic . I tried to put it this way :

string sFile = @"~\files\temp\" + nameDoc() + tipeDoc;

But do not read the file. I await your contribution , thank you.

2 Answers 2

2

You should use Server.MapPath to resolve the ~ properly. You should be using Path.Combine instead of string concatenation, to reduce the risk of path injection.

string sFile = Path.Combine(Server.MapPath(@"~\files\temp\"), nameDoc(), tipeDoc);
Sign up to request clarification or add additional context in comments.

Comments

0

try this

string fileName = nameDoc() + tipeDoc;   
Path.Combine( path, fileName );

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.