where is declare global variable in asp.net and what is use
of global variable
Answer Posted / sridhar
For Classes to be generally consumable across your site you should place them in APP_CODE folder.
This simple class will provide global variable
imports Microsoft.VisualBasic
Public Class Sample
Public Shared Text as String ="Global Variable Example"
End Class
Using it in a page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Me.Title = Sample.Text
End Sub
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What do you mean by serialize and marshalbyref?
What is the good practice to implement validations in aspx page?
How would you turn off cookies on one page of your website?
How do I open an ashx file?
What is the difference between session and viewstate?
What are the data controls available in asp.net?
What are Master Pages in ASP.NET? or What is a Master Page?
Explain page output caching?
What is the difference between visual basic and asp.net?
What does asax stand for?
What is the caspol.exe tool used for?
Define application state variable and session state variable?
What is bound controls
What is a web api? Which protocol is used in a web api?
How response object is related to asp's response object?