2

I have an asp.net page that is already written with inline vb.net. All I really need to do is add a custom attribute to the class but it can't figure out where to add it.

     <%@ Page Language="vb" %>

    <script runat="server"> 

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

           ...

        End Sub
    </script>

In the code that checks for the attribute on the page object, I can see the page.GetType.fullName = "ASP.test_aspx" with the page filename as test.aspx.

Is this possible?

4

1 回答 1

0

我认为您不能直接执行此操作,因为该类是自动生成的,而且我很确定编译器没有添加属性的规定。就个人而言,我会用一个单独的类文件重写页面(无论如何我总是喜欢这样做)。如果这不是一个选项,根据属性和使用它的内容,您可以创建一个从 Page 继承的类,该类在 @Page 指令中具有 on 和继承的属性

于 2013-04-18T21:39:26.993 回答