I have an ASP.NET application to which I want to limit access depending on the user's level of authorization. Currently, I do this by maintaining a database table with the requisitie information.
However, this is a poor method. What I would rather do is have each page (class) define a method (myAuths) that returns the appropriate information to the calling routine. Knowing that the class name is the same as the file name, a routine could find all of the .ASPX files in application's directory, thereby providing sufficient information for doing this.
So basically, in very pseudo-code:
for each ASPX file in myAppDir
dim myClassName as String = FileName - ".ASPX"
dim myClass as myClassName <<<===
authInfo = myClass.myAuths()
myClass = Nothing
next
I have yet to figure out how to implement the marked line. Obviously, what is written here is nonsense.
I thought that this might work:
Dim testObj As Object
authInfo = CType(testObj, myClassName).myAuths()
But I get a compile error of: Type 'Type.GetType' is not defined.
From my reading, this is related to "late binding", but that bit of info has not been terribly useful.
Your help/suggestions are gratefully welcomed.
----
Gerry Roston
gerry@pairofdocs.net
However, this is a poor method. What I would rather do is have each page (class) define a method (myAuths) that returns the appropriate information to the calling routine. Knowing that the class name is the same as the file name, a routine could find all of the .ASPX files in application's directory, thereby providing sufficient information for doing this.
So basically, in very pseudo-code:
for each ASPX file in myAppDir
dim myClassName as String = FileName - ".ASPX"
dim myClass as myClassName <<<===
authInfo = myClass.myAuths()
myClass = Nothing
next
I have yet to figure out how to implement the marked line. Obviously, what is written here is nonsense.
I thought that this might work:
Dim testObj As Object
authInfo = CType(testObj, myClassName).myAuths()
But I get a compile error of: Type 'Type.GetType' is not defined.
From my reading, this is related to "late binding", but that bit of info has not been terribly useful.
Your help/suggestions are gratefully welcomed.
----
Gerry Roston
gerry@pairofdocs.net