I am using ASP.Net + .Net 3.5 + VSTS 2008 + IIS 7.0 + C# to develop a web application. I find when debugging in VSTS 2008, if I call Response.Close() method in page_load (please refer to code below), there will be error (from IE when accessing the page) like can not connect to server.
My question is,
- Normally when should we call Response.Close()? Or no need to call (rely on ASP.Net framework to automatically close)?
BTW: my previous understanding is developer should always call Response.Close when processing is completed at server side and all data has been written to client using Response.Write. Am I correct?
2 Why I met with such error in my code? What is the root cause?
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello World! ");
Response.Close();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…