Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,025

HOME > ASP.NET > ASP.NET Object > ASP.NET Application Variables



Clound SSD Virtual Server

ASP.NET Application Variables

ASP.NET Application Variables ในภาษา ASP.NET เป็น Object ที่ใช้จัดการด้าน แอปพลิเคชันบนเซิร์ฟเวอร์ ซึ่งจะทำให้ติดต่อใช้ข้อมูลร่วมระหว่าง ASP กับข้อมูลที่ไคลเอ็นต์เรียกใช้งาน โดยระหว่างที่ใช่งานร่วมกัน นี้จะมีการสร้างตัวแปรเพื่อใช้ในการเก็บข้อมูล ตัวแปรนี้จะทำงานเรื่อย ๆ ไปจนกว่าจะมีการชัตดาวน์เซิร์ฟเวอร์ รูปแบบ คือ

Language Code : VB.NET || C#

Syntax

Application[.collection|property|method]



ตัวแปร Application ต่างกับตัวแปร Session ตรงที่ ตัวแปร Application เมื่อประกาศแล้ว Client ทุกตัวที่ Online อยู่ในณะนั้นสามารถเรียกใช้งานตัวแปรดังกล่าวได้ ซึ่งต่างจาก ตัวแปร Session จะเก็บตัวแปรและใช้งานได้ในส่วนแต่ล่ะ Client เท่านั้น


AspNetApplication.aspx

<%@ Page Language="VB" %>
<script runat="server">

    Sub Page_Load(sender As Object, e As EventArgs)
		Application("Database") = "mydatabase.mdb"
		Application("UserID") = "myuser"
		Application("Password") = "mypassword"

		ViewApplication()
    End Sub

	Sub ViewApplication()
		Me.lblText1.Text = "Database = " & Application("Database")
		Me.lblText2.Text = "UserID = " & Application("UserID")
		Me.lblText3.Text = "Password = " & Application("Password")
	End Sub

</script>
<html>
<head>
<title>ThaiCreate.Com ASP.NET - Application Object</title>
</head>
<body>
	<form id="form1" runat="server">
	<asp:Label id="lblText1" runat="server"></asp:Label><br />
	<asp:Label id="lblText2" runat="server"></asp:Label><br />
	<asp:Label id="lblText3" runat="server"></asp:Label><br />
	</form>
</body>
</html>


คำอธิบาย
จากตัวอย่างจะเป็นการประกาศตัวแปรชนิด Application ซึ่งตัวแปรนี้จะสามารถเรียกใช้งานทุก ๆ Client ที่กำลังใช้งานอยู่ในขณะนั้น และได้ค่าผลลัพธ์เดียวกัน ซึ่งตัวแปร Application นิยมประกาศใช้ในไฟล์ Global.aspx อาจจะเป็นค่าคงที่หรือ Configuration ต่าง ๆ

Screenshot

Application Object






   
Share

Property & Method (Others Related)

ASP.NET Application.Add() - Application Object
ASP.NET Application.Set() - Application Object
ASP.NET Application.Clear() - Application Object
ASP.NET Application.Remove() - Application Object
ASP.NET Application.RemoveAt() - Application Object
ASP.NET Application.RemoveAll() - Application Object
ASP.NET Application.Contents() - Application Object
ASP.NET Application.Contents.Remove() - Application Object
ASP.NET Application.Contents.RemoveAt() - Application Object
ASP.NET Application.Contents.RemoveAll() - Application Object
ASP.NET Application.Count() - Application Object
ASP.NET Application.Item() - Application Object
ASP.NET Application.Keys() - Application Object
ASP.NET Application.AllKeys() - Application Object
ASP.NET Application.StaticObjects() - Application Object
ASP.NET Application.Lock() - Application Object
ASP.NET Application.UnLock() - Application Object
ASP.NET Application_Start() - Application Object
ASP.NET Application_End() - Application Object
ASP.NET Application_Error() - Application Object

ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-10-27 12:21:09 / 2009-07-26 21:47:46
  Download : Download  ASP.NET Application Variables
 Sponsored Links / Related

 
ASP.NET Response
Rating :

 
ASP.NET Request
Rating :

 
ASP.NET Request.Form
Rating :

 
ASP.NET Request.QueryString
Rating :

 
ASP.NET Cookies Variables
Rating :

 
ASP.NET Session Variables
Rating :

 
ASP.NET Global.asax
Rating :

 
ASP.NET Server Variables
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่