Hi
in my sample asp.net app i need to copy file with a new name. to do this, i'm using this code :
private string _tempDicrectory = "~/temp";
private string _extenstion = ".docx";
private string _sourceFileName = "~/temp/Sample.docx";
protected void btnExtractWord_Click(object sender, EventArgs e)
{
string fileName = string.Format("tmp_{0}", Guid.NewGuid().ToString().ToLower().Substring(0, 8));
string fullPath = _tempDicrectory + "/" + fileName + _extenstion;
File.Copy(_sourceFileName, fullPath); // cause error for _sourceFileName
}
but at runTime, i'm facing the error : Could not find a part of the path '~/temp/Sample.docx'
this error is related to _sourceFileName object. where is the problem and how to solve it ?
thanks in advance
Go to the complete details ...