Creating Global Variables should be required when working in any programming language.
In Classic ASP, it just worked, but in ASP.NET it didn't.
In this article, we will look at both of these Variables that can be used throughout our page.
Frontend
Place this at the top of your page.
[ASP.NET (VB) - FrontEnd GlobalVariables]
CFFCS | CarrzSynEdit: | ASP.NET (VB/C#)
<script runat="server" language="vbscript">
    Public Class GlobalVariables
        Public Shared strSharedArtistFolderID As String
        Public Shared strSharedAlbumFolderID As String
        Public Shared FileToMove As String
        Public Shared MoveLocation As String
        Public Shared MovePath As String
        Public Shared getfile As String
    End Class
</script>


Now, on our page, we can use either of these variables.
Create your Select Statement. Then add in your Global variable like this.
[ASP.NET (VB) - How to use in FrontEnd]
CFFCS | CarrzSynEdit: | ASP.NET (VB/C#)
                    
 If drSet.Read() Then  
     ' Feed your GlobalVariables in one single pass 
      GlobalVariables.getfile  = drSet("MyFile")
End If


Now, anywhere on our page, we can use this.
<%=GlobalVariables.getfile%>
Copy
Search Site
Search Google
Will get the value assigned to this Variable.
Backend

The same concept will work in the Codebehind as well.
Except without the Code Brackets.
[ASP.NET (VB) - BackEnd GlobalVariables]
CFFCS | CarrzSynEdit: | ASP.NET (VB/C#)

    Public Class GlobalVariables
        Public Shared strSharedArtistFolderID As String
        Public Shared strSharedAlbumFolderID As String
        Public Shared FileToMove As String
        Public Shared MoveLocation As String
        Public Shared MovePath As String
        Public Shared getfile As String
    End Class

And as shown in the FrontEnd, we use the same in the BackEnd.

divwrap=ASP.NET (VB) - How to use in BackEnd]
CFFCS | CarrzSynEdit: | ASP.NET (VB/C#)
                    
 If drSet.Read() Then  
     ' Feed your GlobalVariables in one single pass 
      GlobalVariables.getfile  = drSet("MyFile")
End If

[/divwrap]
GlobalVariables.getfile
Copy
Search Site
Search Google