RTE and Web Client Software Factory

Jun 30, 2008 at 4:48 PM
Hi all,

The project I'm currently working on uses the WCSF and I'd like to implement the RTE as a means to enter messages to the user. 

Unfortunately, I've been having major difficulties in getting the page Presenter to read the RTE Text property after editing.  Due to design decisions, each Presenter has a page helper which implements various interfaces for handling events and neither the RTE  nor the View is not directly viewable from this helper.

I've managed to use delegates to access the page code-behind but when it attempts to access the rte.Text propery I get the following error message:
'rteServiceDeliveryMessage.Text' threw an exception of type 'System.Web.HttpException'
"Request is not available in this context"
Can anyone help with this problem?

I understand that due to the implementation of the WCSF and the page helper this is a unique situation - but any kind of work-around would be much appreciated.

Thanks very much in advance,

Jun 30, 2008 at 6:02 PM
Hi Greg,

I have a few quick questions that may help narrow down the cause. Do you happen to be running on Vista? Does the RTE control work for you in a simple web application? Would you be willing to provide the call stack/trace for the error? Could you also post a short code example that causes the error?

Jul 1, 2008 at 8:49 AM
Hi Rob,  I've filled what I can below:

 Do you happen to be running on Vista?    No.
Does the RTE control work for you in a simple web application?   Yes
Would you be willing to provide the call stack/trace for the error? Below
Could you also post a short code example that causes the error?

Call Stack:


RichTextEditor.DLL!AjaxControls.RichTextEditor.Text.get() Line 53  C#<o:p></o:p>

App_Web_h8b80eqx.dll!UserManagement_Options.GetRTEServiceDeliveryMessage() Line 148 + 0xd bytes         C#<o:p></o:p>

UserManagement.DLL!ProjectNamespace.Website.UserManagement.Views.OptionsPresenter.PageHelper.HandleSaveButton(ProjectNamespace.Common.Ajax.Facilitator.EventInfo pr_EventInfo = {ProjectNamespace.Common.Ajax.Facilitator.EventInfo}, ProjectNamespace.Common.Ajax.Facilitator.Response pr_Response = {ProjectNamespace.Common.Ajax.Facilitator.Response}) Line 382 + 0xe bytes             C#<o:p></o:p>

UserManagement.DLL!ProjectNamespace.Website.UserManagement.Views.OptionsPresenter.PageHelper.ProjectNamespace.Common.Ajax.Facilitator.IConfirmHandler.HandleConfirm(string pr_Context = "ConfirmSave", bool pr_Result = true, ProjectNamespace.Common.Ajax.Facilitator.ControlInfoCollection pr_AssociatedControls = {ProjectNamespace.Common.Ajax.Facilitator.ControlInfoCollection}, ProjectNamespace.Common.Ajax.Facilitator.Response pr_Response = {ProjectNamespace.Common.Ajax.Facilitator.Response}) Line 232 + 0xf bytes              C#<o:p></o:p>

ProjectNamespace.Common.DLL!ProjectNamespace.Common.Ajax.Facilitator.Facilitator.HandleCommand(string pr_Command = "ConfirmResponse") Line 412 + 0x27 bytes     C#<o:p></o:p>

ProjectNamespace.Common.DLL!ProjectNamespace.Common.Ajax.Facilitator.FacilitatorHttpHandler.ProcessRequest(System.Web.HttpContext context = {System.Web.HttpContext}) Line 120 + 0xd bytes  C#<o:p></o:p>

System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 0x167 bytes  <o:p></o:p>

System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step = {System.Web.HttpApplication.CallHandlerExecutionStep}, ref bool completedSynchronously = true) + 0x41 bytes                <o:p></o:p>

System.Web.dll!System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(System.Exception error) + 0x1b3 bytes               <o:p></o:p>

System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback cb, object extraData) + 0x8e bytes           <o:p></o:p>

System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr = {Microsoft.VisualStudio.WebHost.Request}) + 0x1b5 bytes        <o:p></o:p>

System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr) + 0x62 bytes      <o:p></o:p>

System.Web.dll!System.Web.HttpRuntime.ProcessRequest(System.Web.HttpWorkerRequest wr) + 0x38 bytes       <o:p></o:p>

WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost.Request.Process() + 0x113 bytes        <o:p></o:p>

WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Microsoft.VisualStudio.WebHost.Connection conn = {System.Runtime.Remoting.Proxies.__TransparentProxy}) + 0x5c bytes               <o:p></o:p>

[Appdomain Transition]          <o:p></o:p>

WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(object acceptedSocket) + 0x86 bytes            <o:p></o:p>

mscorlib.dll!System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(object state) + 0x1a bytes          <o:p></o:p>

mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x81 bytes        <o:p></o:p>

mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(System.Threading._ThreadPoolWaitCallback tpWaitCallBack) + 0x50 bytes        <o:p></o:p>

mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(object state) + 0x60 bytes           <o:p></o:p>

I've added a try catch to the Text property in Rte.cs so that may skew the top line number there. 
The error actually occurs on line 47 when this.Page.Request gives the error: 'this.Page.Request' threw an exception of type 'System.Web.HttpException'.

I'm also fairly sure I've set up the RTE correctly as I can assign text to it from the Presenter via the View on load.

Even if this error doesn't make sense, ideas for a workaround are more than welcome - I've exhausted all my own ideas and deadlines are drawing near!

Jul 1, 2008 at 7:41 PM

Don't know for sure what the error is, but here is a list of what may be things that may help you figure out what's going on.

1) The text property is passed from the Javascript code over to the server side via httpRequest/Response.
2) Html tagging is passed which may trigger page validation to throw an exception due to potential security alert.
        a) if this either switch page validation off or write a filter to make the rte data "risk free"
3) If you can step your debugger to an arrea which allows you to view the Page object in your locals tab, it may be possible to inspect the htmlRequest/Response to see if the rte data has reached it.  NOTE: debug after postback of RTE.
        The debuger/locals path to the page request is:
        Look at the AllKeys property.  Somewhere in there, the editor should put an id that ends with '$editor' .  If it's there check it's value, does it contain the expected HTML?

  If there's no '..some stuff...$editor' key in the request, the problem could be that the editor's CopyText javascript function.  This needs to be called in order to pass the data from client to server.  I call it by setting this in my page load:
Page.Form.Attributes.Add("onSubmit", "CopyText(); return true;")



you may need to do something different depending on your special circumstances.

I hope some of this info helps you find a solution.

Jul 2, 2008 at 12:39 PM
Rob & mrfinger,

I've come to conclusion that the problem isn't with the RTE itself but the implementation of the WCSF, the internal central nervous system we call the Facilitator and other design decisions.

I've found a workaround solution where I wrapped the save button in a div that fired a JS script on mouse-over.  This script took the text from the RTE and copied it to a .net Hidden control.
The Hidden control was passed back to the Presenter via the View and the text was read from the View where necessary.

Cheers for your help guys - it's always very much appreciated!