Re: VB.Net 2.0 b2 + Web UserControl

Tech-Archive recommends: Fix windows errors by optimizing your registry



If the code in the .vb file in App_Code is in a class definition, then it should all be ok -- ASP.NET will compile the .vb file for you and the resultant assembly should be accessible from all of your pages.

-Brock
DevelopMentor
http://staff.develop.com/ballen



I upgraded a VB.Net 1.1 project to 2.0b2 and now I can't seem to
figure out how to fix my user controls.  I have a user control named
SecurityControl that contains a few static methods and properties (as
well as instance methods and properties).  Now that I've upgraded the
project to 2.0b2, my User Controls can't be accessed from the new
App_Code files (my code files from before the upgrade).  I've tried to
do the same thing with a new web application project, but still no
luck.  How can I write the following from within a "Module" that is
under App_Code?

App_Code\Common.vb:

Public Function SomeTestMethod() As Boolean
' Some validation or something here...
' Check security.
Return SecurityControl.IsInRole("MyRoleName")
End Function
In SecurityControl.ascx.vb:

Public Shared Function IsInRole(ByVal Role As String) As Boolean
' Do some error checking before the following call.
Return Thread.CurrentPrincipal.IsInRole(Role)
End Function
Thanks in advance,
Mythran



.



Relevant Pages

  • VB.Net 2.0 b2 + Web UserControl
    ... Now that I've upgraded the project to 2.0b2, my User Controls can't be accessed from the new App_Code files. ... Public Function SomeTestMethod() As Boolean ... Public Shared Function IsInRoleAs Boolean ...
    (microsoft.public.dotnet.framework.aspnet)
  • Questions about conversion of .Net 1.1 to 2.0
    ... We have finally gotten the upgrade to .Net 2.0 and I have been tasked to try ... to convert two projects and test before we do the conversion on the server.. ... use VB as our code-behind and have several User Controls in our projects. ... and how do I fix it? ...
    (microsoft.public.dotnet.framework.setup)
  • RE: passthrough properties
    ... > for ASCX user controls?) ... > I am writing a user control that has a combo box in it. ... > Public WriteOnly Property AutoPostBackAs Boolean ...
    (microsoft.public.dotnet.framework.aspnet)
  • passthrough properties
    ... for ASCX user controls?) ... I am writing a user control that has a combo box in it. ... Public WriteOnly Property AutoPostBackAs Boolean ...
    (microsoft.public.dotnet.framework.aspnet)