First, adding a namespace isn't going to do anything for you. This just shows that you have no idea what a namespace is or what it's used for.
Second, one of my greatest pet peeves is seeing people call
.ToString()
on a string. Come on!! Think about that!!
Third, your filename is an invalid path. As written, because of the
@
character, your filename is "D:\\File\1.pfd". The double backslash near the beginning is causing a problem.
I think you're not understanding the difference between a string that should be treated literally and one that should be processed for escape sequences. Remove one of the backslashes from the doubled-up pair and it'll fix the problem.
Lastly, If you want to send a file in the response, you can shorten this code up greatly and drop reading the file. You don't need to read it at all:
string strFileName = @"D:\File\1.pdf";
Response.AppendHeader("content-disposition", "attachment; filename=" + strFileName);
Response.ContentType = "application/pdf";
Response.WriteFile(strFileName);
P.S.: What's with the Hungarian notation?? You know, the prepending of the variable type to the name of the variable?? That went the way of the dinosaurs a long time ago.