Solved

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

Posted on 2003-11-27
5
230 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now