where is declare global variable in asp.net and what is use
of global variable

Answers were Sorted based on User's Feedback



where is declare global variable in asp.net and what is use of global variable..

Answer / sridhar

ou can use web.config to store global varriables

<appSettings>
<!-- Generic Settings -->
<add key="PDFBaseDir" value="\\server\pdfs\"/>
</appSettings>

PDFBaseDir Can be used across application

Is This Answer Correct ?    5 Yes 1 No

where is declare global variable in asp.net and what is use of global variable..

Answer / 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

where is declare global variable in asp.net and what is use of global variable..

Answer / kinjal panchal

we can declare global variable in class file. and this
global variable we can use in whole application.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Where do you store the information about the user?s locale?

1 Answers  


Define view state.

0 Answers  


what is caching

3 Answers  


what r the Templeats in ASP.net?

5 Answers   Intel, VBV,


what is DLL Hell and how it is solved in .NET?

24 Answers   icegen, next, -uk, NIIT,






Is asp.net mvc front end or backend? : Asp.Net MVC

0 Answers  


How can we prevent browser from caching an aspx page?

0 Answers  


Explain Life cycle of ASP.NET page when a request is made.

0 Answers  


In your web.config file which attribute of <Globalization> element identifies the default culture that will be used for web request?

1 Answers  


difference between writing connection string in web.config through connection string and appsettings

2 Answers   iSoft,


How we can bind textbox,listbox and datagrid to sql server database in asp.net using visualstudio.net language (vb.net)?

2 Answers   rocsearch,


Difference between server.Execute and response.redirect ?

5 Answers   Accenture, Keane India Ltd,


Categories