Solved

C# (urgent): share Application Variables between C# and ASP/VB?

Posted on 2003-11-27
5
235 Views
Last Modified: 2010-04-16
Hi all,
I need to access the same data from some ASP/VB scripts and also from some C# scripts.

In VB it's done this way:
------------------------
Application("xxx") = "dummyData"
------------------------

I try to access it in C# with this code:
------------------------
if (Application["xxx"] != null)
      Response.Write("App(xxx): "+ Application["xxx"].ToString()+"<br>");
else
      Response.Write("App(xxx) is null :(<br>");
------------------------

It allways returns the else part, why does it not find the data inside the Application variable?

Thank you and best regards
0
Comment
Question by:Smoerble
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Expert Comment

by:TheAvenger
ID: 9831524
I don't know why you ask almost the same question again, but I already gave you the solution here:

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20809219.html
0
 

Author Comment

by:Smoerble
ID: 9831636
Sorry, this is a complete different issue:

I set the Application variable in setVar.asp and want to read it in getVar.aspx.
0
 
LVL 22

Accepted Solution

by:
_TAD_ earned 250 total points
ID: 9838513


This is an interesting thread, something that I have not done before (but may do in the future).


Personally I would look into using MarshalAs or MarshalByRef attributes.

I know that if you are trying to use C++ variable declarations in C# sometimes you need to use the MarshalAs attribute.


This probably doesn't help any since the variables are being declared and used inside the .Net framework.  However I would be very interested in seeing the resolution if you get it working.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question