views:

78

answers:

1

Hi, I'm trying to translate these Coldfusion pages to asp.net. It seems like with ColdFusion, if there are variables defined in a page, say pageA and then pageB includes this page:

<CFINCLUDE template="pageA.cfm">

Then I will have access to all the variable defined in pageA. Same thing if I include another page, pageC in pageB.

<CFINCLUDE template="pageC.cfm">

Then, in pageC, I will be able to reference all the variables in pageB. How can I do this in ASP.NET? Do I have to use UserControls? Do I have to use Session Variables to get the same result?

+1  A: 

The cfinclude tag will include the file referred to in the template parameter in the current template and process it like any other code in the page. A User Control in ASP.NET can be created to exhibit the same behavior, so that would be the way to go. Session variables shouldn't be necessary unless the templates brought in through cfinclude use sessions.

Here's more info on including a User Control if you need it.

Pablo
But access to the variables isn't the same, with a user control I don't have access to the variables in the includer like you do in CF.That's what I'm wondering about.
Can you make the variables inside the User Control public? I would think the includer page should be able to access them in that case.
Pablo