locked
How does response.write() Works? RRS feed

  • Question

  • hi guys

    when i use response.write() method in page_load event,

    the page show totally black when i run it,

    it seems like asp.net not render any compoments to browser.

    i canced use response.write()method,it shows normal.

    when its bug its look like this https://postimg.cc/image/9s1dw4gj9/ x.x cant post img...

    I use .net 4.6framework and run in vs2017 iis express.

    I have  questions about :

    1 using Response.write() method if or not  affect webpage Page_Render or something .

    2 asp.net webform Page's life ,why  my page_render event not use?

     protected void Page_Load(object sender, EventArgs e)
            {
               using (SqlQueryDataContext sqlQuery = new SqlQueryDataContext())
                  {
                      //something my logic not important                           
                    //Response.Write("<script>alert('请登陆');</script>");
    
    
                }
            }
            protected void Page_PreRender(object sender, EventArgs e)
            {
               // Response.Write("PreRender");
            }
            protected void Page_Render(object sender, EventArgs e)
            {
                Response.Write("render");
    
            }

    thanks first!

    Friday, April 27, 2018 7:48 AM

Answers

All replies