Solved

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

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

680 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