[英]How Add Control to web page in Application_Start event
Is it possible to add control to a page in Application_Start Project? 是否可以将控件添加到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.
而且在IIS集成模式下,您甚至无法访问HttpContext对象,例如Request,Response,Session等。因此,谈论Application_Start中的控件和表单根本没有任何意义。
您需要在页面顶部添加这样的内容
<%@ Register TagPrefix="uc1" TagName="links" Src="WebUserControl1.ascx" %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.