ASP.NET Custom Control - Unknown server tag

前端 未结 5 1737
自闭症患者
自闭症患者 2020-12-15 03:00

I\'ve made a custom control that inherits from a Literal control. When I try and use my control on a page a parsing error is thrown. I\'ve added this to my web.config

<
5条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 03:47

    When adding a namespace, I've found I also need the assembly. If your assembly is also myApplication do this in web.config:

    
    

    Then, just clean and rebuild and it should all work. Once this is in your web.config, you don't need to add it to your page unless you're using this in a control in the same directory, then you'll need the reference at the top of the web form. But, I recommend against using custom server controls in the same directory as user controls.

提交回复
热议问题