How can we write a blank file in C# Response Object?
I want to write a file whose path does not exist at all.
System.Web.HttpContext.Current.Response.WriteFile("blank.txt")
how can I do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can not. What you can do is, make an empty file and name it “blank.txt” and keep it in your solution.
Could I know the reason for writing blank file. It is not equivalent of not writing anything in response ?
UPDATE
Building on Jon’s idea, you can even simply write the HTTP headers
UPDATE 2
If you already have a errorLog.txt file, use Response.WriteFile directly