access to the current executing ASP.NET handler's (page) view state
There may be a time you need access tothecurrentexecutingASP.NEThandler's(page)view state without having a reference totheexecuting page. I wanted to from an action handler (document.AfterSave) today...
might work, but ViewState is inaccessible due to it's protection. (System.Web.UI.Page ViewState property is not public, but protected)
Maybe it could be added to the core to expose a public PageViewState property. Allowing me to grab theviewstate without having a direct reference tothe page instance.
Does anyone else have any other ideas?
(Ps my workaround at present is to use the Session to store the persistent data I require, but viewstate would be better as should my logic is such it should expire with the page, and not remain in session...)
in the admin area, when a user comes to the editcontent page store the document.updatedate (if !IsPostBack) when the user then comes to Save/Publish check that the stored document.updatedate is the same as the current document.updatedate (eg no one else has amended and saved/published the page whilst I have been editiing)
Viewstate for me is the perfect storage as I only need to persist the stored document.updatedate on first entry to the editpage for the lifetime of the page. (adding to session causes unnecessary overheads, and current.items isn't useable as that is just for the exectuing request lifetime.)
I think by not allowing use of the viewstate in umbraco you are missing a very valid storage mechanism in the Application/Session/Viewstate/Items hierarchy of need.
Resorting to the classic asp method of hidden field on the page just leaves a bad taste in my mouth :-)
ps I'm doing this via the actionhandlers... pageLoad, BeforeSave, AfterSave, BeforePublish and AfterPublish so don't have access to the current page context.
I am using umbraco v4.5.2 as host in a medium trust cloud environment (keep forgetting to add that strap line.. if only the forum had a signature feature.)
(Ps I do have this all working but using session state)
Concierge had been mentioned before on another post but as I run 200+ sites in a cloud environment which potetntially will be going to umbraco, no license covers me as severwise licensing only per IP, not that model in the cloud (so i'd be paying per seat so quickly becomes less than ideal from a budget perspective) . Also not sure if concierge runs under medium trust?
Also Check in/Check out for the comon user that we deal with has proved very frustrating with another cms in the past.
If I read it right concierge doesn't force check in /out so would need to add the check I have proposed/implemented as a check as well.
But actually this is a bit off topic... I want to utilise the viewstate, a very common practice in asp.net coding.
I have created an issue on codeplex, so lets see what happens there, I could just branch from the umbraco trunk and add this myself, but on eof the reasons for going to umbraco is to free up support/developement of the underlying cms which we did previously. So trying to avoid that at all costs at present.
Yeah don't know if Concierge runs in Medium Trust, that'd be a question for the HQ, but I thought most cloud was full trust as it was generally VPS, but I'm not really that into cloud at the moment :P.
Just a point of note I would not run 200 sites out of 1 Umbraco instance, I wouldn't run more than 10 full-sized sites, there's a lot of reasons for this like single point of failure (one site goes down, memory leaks, etc, they all suffer) and performance (that would be a HUGE cache file) being the main ones.
not 200+ sites under one instance, 200+ separate instances... :-) and hence why each on a spearate ip.
(VPS if it was a cloud server I think, but we run in a shared hosting environement)
Will look into reflection, my understanding must be wrong, I thought reflection was just a read only way finding out what's going on under the covers...
access to the current executing ASP.NET handler's (page) view state
There may be a time you need access to the current executing ASP.NET handler's (page) view state without having a reference to the executing page. I wanted to from an action handler (document.AfterSave) today...
I thought something like
return ((BasePage)sender.HttpContext.CurrentHandler).ViewState;
might work, but ViewState is inaccessible due to it's protection. (System.Web.UI.Page ViewState property is not public, but protected)
Maybe it could be added to the core to expose a public PageViewState property. Allowing me to grab the viewstate without having a direct reference to the page instance.
Does anyone else have any other ideas?
(Ps my workaround at present is to use the Session to store the persistent data I require, but viewstate would be better as should my logic is such it should expire with the page, and not remain in session...)
You can add a feature request to get this added but I can't see a real need for it, I've never had a need for this is application I've built...
You could access the property via Reflection alternatively.
Can you explain what you're trying to achieve and maybe there's another way to do it without requiring ViewState as a publicly accessibly property.
in the admin area, when a user comes to the editcontent page store the document.updatedate (if !IsPostBack) when the user then comes to Save/Publish check that the stored document.updatedate is the same as the current document.updatedate (eg no one else has amended and saved/published the page whilst I have been editiing)
Viewstate for me is the perfect storage as I only need to persist the stored document.updatedate on first entry to the editpage for the lifetime of the page. (adding to session causes unnecessary overheads, and current.items isn't useable as that is just for the exectuing request lifetime.)
I think by not allowing use of the viewstate in umbraco you are missing a very valid storage mechanism in the Application/Session/Viewstate/Items hierarchy of need.
Resorting to the classic asp method of hidden field on the page just leaves a bad taste in my mouth :-)
ps I'm doing this via the actionhandlers... pageLoad, BeforeSave, AfterSave, BeforePublish and AfterPublish so don't have access to the current page context.
actually already said that in my first post.
First off, what you're trying to achieve will be problematic unless you're using Umbraco 4.5.x (see http://www.aaron-powell.com/the-great-umbraco-api-misconception for an explanation).
Concierge - http://umbraco.org/tour/for-professionals/umbraco-pro/concierge will actually solve your problem though, as it has the ability to lock a page to an editor.
I am using umbraco v4.5.2 as host in a medium trust cloud environment (keep forgetting to add that strap line.. if only the forum had a signature feature.)
(Ps I do have this all working but using session state)
Concierge had been mentioned before on another post but as I run 200+ sites in a cloud environment which potetntially will be going to umbraco, no license covers me as severwise licensing only per IP, not that model in the cloud (so i'd be paying per seat so quickly becomes less than ideal from a budget perspective) . Also not sure if concierge runs under medium trust?
Also Check in/Check out for the comon user that we deal with has proved very frustrating with another cms in the past.
If I read it right concierge doesn't force check in /out so would need to add the check I have proposed/implemented as a check as well.
But actually this is a bit off topic... I want to utilise the viewstate, a very common practice in asp.net coding.
I have created an issue on codeplex, so lets see what happens there, I could just branch from the umbraco trunk and add this myself, but on eof the reasons for going to umbraco is to free up support/developement of the underlying cms which we did previously. So trying to avoid that at all costs at present.
Thanks for you coments, very welcomley recieved.
Yeah don't know if Concierge runs in Medium Trust, that'd be a question for the HQ, but I thought most cloud was full trust as it was generally VPS, but I'm not really that into cloud at the moment :P.
Just a point of note I would not run 200 sites out of 1 Umbraco instance, I wouldn't run more than 10 full-sized sites, there's a lot of reasons for this like single point of failure (one site goes down, memory leaks, etc, they all suffer) and performance (that would be a HUGE cache file) being the main ones.
Back on topic, reflection would be the easiest way to do what you want to do without modifying the core (see: http://stackoverflow.com/questions/686482/c-accessing-inherited-private-instance-members-through-reflection ).
not 200+ sites under one instance, 200+ separate instances... :-) and hence why each on a spearate ip.
(VPS if it was a cloud server I think, but we run in a shared hosting environement)
Will look into reflection, my understanding must be wrong, I thought reflection was just a read only way finding out what's going on under the covers...
ta.
Oh no, you can use it to do sets and gets, invoke methods, etc. Pretty much everything is achievable from reflection ;)
is working on a reply...