|
|
 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

November 12th, 2003, 02:41 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: , VA, .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Check for existence of a session variable
I want to check for the existence of the variable session("MyVariable") on my user control. If it does not exist or is unassigned then I want to query the database and assign Session("MyVariable") to a value. Otherwise, if the variable exists I want to do nothing. Is there way to do this?
In ColdFusion we use ParameterExists() or IsDefined(). is there an equivalent in ASPX?
Thanks
|

November 12th, 2003, 05:03 PM
|
 |
Friend of Wrox
Points: 16,368, Level: 55 |
|
|
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,394
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
All you need to do is this:
If Session.Item("MyVariable") Is Nothing Then
'assign it here.
End If
Peter
------------------------------------------------------
Work smarter, not harder.
|

November 12th, 2003, 11:09 PM
|
|
Authorized User
|
|
Join Date: Nov 2003
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
if u are using c-sharp
you could do as below:
if(Session[""]!=null)
{}
else
{}
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |