简体   繁体   中英

How Add Control to web page in Application_Start event

Is it possible to add control to a page in Application_Start Project?

thanks

No, it is not possible. No form exist at this stage of the application lifecycle. And in IIS Integrated mode you don't even have access to HttpContext objects such as Request, Response, Session, ... So talking about controls and forms in Application_Start simply doesn't make any sense.

您需要在页面顶部添加这样的内容

<%@ Register TagPrefix="uc1" TagName="links" Src="WebUserControl1.ascx" %> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM