开发者

Use Attribute In Asp.net

I have something issue on how to use Attribute in asp.net page class. The below code slice is the background:

A method is declared like below in a aspx class page:

[SomeAttribute(Name=”Test”,TargetType=typeof(System.Int32)]
Public void Verify(object obj)

{

  //code to verify…

}

And other pages would use the attribute too.

Now I want a Module to do is that it will invoke a method before the Verify method is calling. Currently, my solution is using a customer IHttpModule implement cl开发者_开发百科ass to do it by registering the BeginRequest event.

In the method referred to the event, how can I get the method that is calling currently by request in asp.net ? This is the way I could know the request is calling Verify method so that I can do something with the Attribute on it.


I'd recommend checking out PostSharp:

http://www.sharpcrafters.com/

It's got all that goodness, and more, built in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜