Application variables

G

Genaro Sanchez

Hi group. I have 2 web applications. I start the first application with a
default.aspx page. On a button click, it makes a reference to another
application. I want to store 3 variables in the click event of the button
and read this 3 variables in the Application_Start event on the second
application. How can I do it?

Greets.

Genaro
 
P

Peter Rilling

I might be wrong, but I do not think you can do this. If you think about
it, how can you store something an a variable for an application that does
not exist yet. Not to mention, I don't think you can have on app interface
with the memory of another, they are different AppDomains and, just like
processes, are isolated.


Why can't you just pass them using the querystring and process them during
the Init or Load events?
 
G

Genaro Sanchez

Ok, but in the other application, there is no aspx page, just libraries. So
in the App_Start i want to retreive some variables. Can I send params to
App_Start event on th global.asax?

Thanks
 
J

John Timney \( MVP \)

An easy way to pass params between two different applications is to pass the
values on the querystring or make a post request. You dont stipulate if you
expect to call the second application, or pass control to it. Calling its
the easiest, you can use a simple webrequest. However, I dont believe you
can pass parameters to the app start event directly from another
application. You will have to start the application and then extract the
params from the request.
 
G

Genaro Sanchez

Thank you. I will try with requests.

Greets

John Timney ( MVP ) said:
An easy way to pass params between two different applications is to pass
the values on the querystring or make a post request. You dont stipulate
if you expect to call the second application, or pass control to it.
Calling its the easiest, you can use a simple webrequest. However, I dont
believe you can pass parameters to the app start event directly from
another application. You will have to start the application and then
extract the params from the request.
--
Regards

John Timney
Microsoft MVP
 
G

Guest

Genaro,
Normally the way you would do this is have the button make a POST (or a GET)
to the remote application's page, have it read the 3 form fields from its'
Request.Params collection , and stored them in Application state. I suspect
you'll have a very difficult time getting this to happen inside the
Application_Start event in Global. You can do the POST or GET with WebClient
class.
Peter
 
G

Guest

Genaro,
This is getting a bit confusing. When you refer to "the other application"
apparently you seem to be saying this application is not even an IIS Web
application since it has no "Pages".

No, you cannot expect to pass variables to it's Application_Start method in
Global, because a web application is actually "Started" when the first page
request comes in. So, you gotta have at least one "Page"!

Hope that helps.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top