473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Session Variables & C# Casting

I am new to Asp world and I have a doubt as follows. I
have a class called objTranslator, which I declare and
initiate global.asax as follows.

Session_Start
csTranslator.objTranslator sesObjTranslator= new
objTranslator();
Session["sesTranslator"]=sesObjTranslator;
----------------
Now in WebForm

private csTranslator.objTranslator webTranslator;

In Page Load

if(Session["sesTranslator"]!=null)
webTranslator=(objTranslator)Session["sesTranslator"];

The question is why do I have to explictly cast the
session variable sesTransilator to objTransilator while it
is holding a reference to sesObjTranslator.

So actually what type is the session variable.

In VB.Net one can directly use

webTranslator=Session("sesTranslator")

What is the difference here?

Thanks,

Rajesh Abraham Chacko

Nov 17 '05 #1
0 4055

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Don Grover | last post by:
I have to modify a site that uses both Cookies & & Session variables, (Array) So that it reports back in a web page if they have cookies or Session variables security high or locked out. Im...
14
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you...
8
by: Ben | last post by:
Hi there I am writing a C# application that is making multiple POST requests to an ASP.NET page. I would like to take advantage of ASP.NET sessions to store some data on the server side. Where do...
1
by: Craig | last post by:
I'm using FormsAuthentication. If the session restarts, obviously the session variables are cleared, but the security ticket is still active. Since I use variables in the Session to determine what...
7
by: tshad | last post by:
Can I directly access an object member from an object I have saved as a session variable? I am carrying a session variable for my user information as separate session vaiables for each...
2
by: Jeff | last post by:
ASP.NET 2.0 In the business logic layer I've got the code (see CODE) below, this code gives a compile error (see ERROR) CODE: List<Messagemessages = null; messages =...
0
by: bharathreddy | last post by:
Here I will given an example on how to access the session, application and querystring variables in an .cs class file. Using System.Web.HttpContext class. 1) For accesing session variables :...
13
by: =?Utf-8?B?ZG91Zw==?= | last post by:
I support several intranet sites one of which had NO STATE. Even though content has ASP extensions, it was all rendered HTML. Site had NO session or application variables being managed. Site had...
3
by: Mark Rae [MVP] | last post by:
"Lloyd Sheen" <a@b.cwrote in message news:uL5TPXPvIHA.1688@TK2MSFTNGP06.phx.gbl... Surely that will throw an exception because you're trying to populate a DataSet variable with an object...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.