WebCustomControl and session

M

Mariusz

Hi,

I would like to know if this is possible to gain access to session in
WebCustomControl. Cause I need to pass some data and persist it. I know that
it is possible to have acces to QueryString but this is not enought.

BTW: How do You handle such sitiuation where control have a lot of
additional properties that must be persisted. How do You persist them? In
session? Request? Forms?

Another question - is is possible to include some aspx'es in
WebCustomControl dll? Cause my control makes a call to the .aspx using
IFrame, and this aspx is internal part of the control. Without this control
wont work. I know that this is not good idea to make aspx an integral part
of the control but I wanted to be able to reload contents of the control
without reloading the whole page.
 
R

Robert Koritnik

Of course it's possible. Check for HttpContext.Current. If it's not null,
you have access to Session, Cache, Application, Request, Response... etc.
 
R

Robert Koritnik

About persisting properties. Hmmm. Depends on properties. The most common
way is to store properties to ViewState if you have to. But if functionality
demands more, you can use alternative storages like Session, Application,
Cache...

Normally some property as collections of some objects that are filled from
XMLs, are normally put into Cache with file dependancy. Especialy if data is
shared between users (like some sort of application menu item collection)...

So the answer is: There is no ultimate store... Each has its pros/cons...
Use the one that's most appropriate for the desired functionality...

About the custom control containing ASPX? I don't really get it what you
want to do. Qour custom control, an IFRAME an ASPX... Where what how? Try to
explain this in more detail. At least to me. Looks like I'm stupid.
 
R

Robert Koritnik

Or over this.Page… Every web custom control inherited from Control inherits
Page property from it.
 
M

Mariusz

About persisting properties. Hmmm. Depends on properties. The most common
way is to store properties to ViewState if you have to. But if functionality
demands more, you can use alternative storages like Session, Application,
Cache...

Yes I know. Right now I'm using Session to store all my data. And I think
that I will keep this but just wanted to know what are You using.
And btw: I'f found that I have acces to Page in Control. My foult :)
About the custom control containing ASPX? I don't really get it what you
want to do. Qour custom control, an IFRAME an ASPX... Where what how? Try to
explain this in more detail. At least to me. Looks like I'm stupid.

It's little hard to explain. I'm using combination of user/custom control,
aspx page and IFrame to create component that can be
reloaded/moved/minimized and even closed without reloading the rest of the
page. This is very usefull but I have to use aspx'a as a target for IFrame
cause ascx cannot be target in IFrame. And it must be in IFrame so I can do
all the operations I mentined before. I hope it's more clearly explained
right now :)
 
R

Robert Koritnik

Create the barebone ASPX and include it as a resource in your project. But
what to do with it then? Hmmm. One possibility is to write it to disk and
redirect to it, but you have to make shure that the class it refers to
really does exist in your assembly.

Maybe someone else has done something like forcing the asp.net CLR to
process the aspx. Probably it's possible but if I were you, I'd check the
namespaces that would fit the idea...
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top