Click here to Skip to main content
15,885,366 members
Articles / Web Development / ASP.NET

AsyncMethods - An Improvement on Microsoft's ScriptMethods

Rate me:
Please Sign up or sign in to vote.
4.76/5 (9 votes)
10 Aug 2011CPOL11 min read 29K   362   17  
A lightweight, secure, and better organized version of Microsoft's ScriptMethods.
Imports Microsoft.VisualBasic

Public Class ForumAsyncMethodAttribute
    Inherits AsyncMethodAttribute

    Private MyValidUser As UserType = UserType.Everyone
    Public ReadOnly Property ValidUser() As UserType
        Get
            Return MyValidUser
        End Get
    End Property

    Public Sub New(ByVal validUser As UserType)
        MyValidUser = validUser
    End Sub

    Public Overrides Function IsValid(ByVal p As Page) As Boolean
        Dim fp As ForumsPage = CType(p, ForumsPage)

        If (fp.CurrentUser.UserType And ValidUser) = fp.CurrentUser.UserType Then Return True

        Return False
    End Function
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) digifi inc.
Canada Canada
Clayton Rumley is web developer for hire from Winnipeg, Manitoba, Canada.

Comments and Discussions