How can I flush the total Page object which represents a HTML page in ASP .net

31 views Asked by At

I am working on a prebuilt API in a .net server. So there I saw we use Page class and append some js external links as <link> tag and I want to flush them early so that the client can download the js files as soon as it's available, but when I am doing:

Page.Header.Controls.Add(new LiteralControl("<link rel = 'preload' href= 'the external src'/>"));

HttpContext.Current.Response.Flush();

I can't see it getting there in the dev tools. I am not sure do I need to add the Page object to the buffer explicitly or not to flush the whole HTML page. If yes then how ? and if no then what could be the possible reason I am not able to see any difference in the dev tools after flushing.

  1. When I add them in the Response headers they just works fine but not in case if I add them to the Page instance.

  2. Also I think the flush is working since the status code is getting updated it's just that either the buffer is empty or the client is not parsing the html.

0

There are 0 answers