Typps with VS2010

Sep 13, 2010 at 11:26 PM

So I can't seem to get the typps wysiwyg rich text editor to work when I create a site using VS2010 c#.  Is that because it targets .NET4.0 and not .NET3.5?

The Typps Editor works great in VS2008 targeting .NET3.5 - did I miss something or can this be easily changet to work with VS2010?

Thanks,

Coordinator
Sep 13, 2010 at 11:52 PM

The current version is developed in vs2k10, and the target framework version is 3.5 ; So I'm not sure why you are having hiccups. The online demo for instance is running on a webhost that doesn't support .net 4.0 ; .NET 3.5 simply adds features incrementally to 2.0 and 3.0 so targetting this version of the framework should ensure that it works for you in 3.5 (which is simply an incremental build to 2.0 and 3.0 so not a whole deal changes) and it should work on the 4.0 runtime too.

Let me know if you find out what's the problem you are facing. I will be making a new release this week ( that will include updates for the past 2 weeks because I missed an iteration last week), so if you find something before this saturday and it's a quick fix you'll get it by the end of the week.

Alessandro

Coordinator
Sep 13, 2010 at 11:57 PM
Edited Sep 13, 2010 at 11:58 PM
Diesel wrote:

So I can't seem to get the typps wysiwyg rich text editor to work when I create a site using VS2010 c#.  Is that because it targets .NET4.0 and not .NET3.5?

The Typps Editor works great in VS2008 targeting .NET3.5 - did I miss something or can this be easily changet to work with VS2010?

Thanks,

One thing you can check quickly is your web.config file. When you drag the control the first time and drop it onto your webform from the toolbox or open an existing page where the control sits in vs.net designview, this will trigger some designer specific code that should have registered an httphandler for iis6/7 in your web.config file automatically. Make sure you have these settings. All content is stored as resources in the dll and served through this httphandler and it's very important you have it specified in your web.config file.

Sep 14, 2010 at 12:47 AM

So i created a new site in VS2010 and did the above drag and drop.  I checked the Web.config and found that the httphandler was added automatically as described however Typps still doesn't work properly.  Soooo...When I right click on the project and change the target frame work from 4 to 3.5 everything works perfectly... 

 

Coordinator
Sep 14, 2010 at 1:21 AM
ale55andro wrote:
Diesel wrote:

So I can't seem to get the typps wysiwyg rich text editor to work when I create a site using VS2010 c#.  Is that because it targets .NET4.0 and not .NET3.5?

The Typps Editor works great in VS2008 targeting .NET3.5 - did I miss something or can this be easily changet to work with VS2010?

Thanks,

One thing you can check quickly is your web.config file. When you drag the control the first time and drop it onto your webform from the toolbox or open an existing page where the control sits in vs.net designview, this will trigger some designer specific code that should have registered an httphandler for iis6/7 in your web.config file automatically. Make sure you have these settings. All content is stored as resources in the dll and served through this httphandler and it's very important you have it specified in your web.config file.

That's a bit strange. If you notice the sample project in the downloads, that particular project targets 4.0 and everything just works. I have just verified in case using IIS vs Builtin webserver ( cassini webserver) made a difference and I have verified that the target framework in IIS 7 app pool is set to target 4.0 runtime and it works perfectly. So unfortunately I am unable to reproduce neither in IIS nor cassini but I'm curious what could cause the problem your seeing. 

Perhaps I should have asked earlier, but when you say it doesn't work, what do you see exactly as non working behavior. That might help me to have a better idea and fix the problem quickly. In any case, I shall experiment more with different settings and let you know if I find something out of the ordinary.

Thank you for reporting.

Alessandro

Sep 14, 2010 at 1:30 AM

The non working behavior that I see are described below:

1. Click the HTML view and nothing happens

2. Click the Design View and nothing happens

3. Save the Editor Text to a lable via a button click ex.. ( Label1.Text = Editor1.Text;) results in the following error: 

A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$Editor1$editortext="<P><BR></P>").

Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. To allow pages to override application request validation settings, set the requestValidationMode attribute in the httpRuntime configuration section to requestValidationMode="2.0". Example: <httpRuntime requestValidationMode="2.0" />. After setting this value, you can then disable request validation by setting validateRequest="false" in the Page directive or in the <pages> configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. For more information, see http://go.microsoft.com/fwlink/?LinkId=153133.

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$Editor1$editortext="<P><BR></P>").

 

I have set the validateRequest="false" and that hasn't made any difference...

Hummm??  like I said - If i change the target frame work to 3.5 all is well but when i change it back to 4.0 - I get the big crash...

Coordinator
Sep 14, 2010 at 1:37 AM
Edited Sep 14, 2010 at 1:39 AM
Diesel wrote:

The non working behavior that I see are described below:

1. Click the HTML view and nothing happens

2. Click the Design View and nothing happens

3. Save the Editor Text to a lable via a button click ex.. ( Label1.Text = Editor1.Text;) results in the following error: 

A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$Editor1$editortext="<P><BR></P>").

Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. To allow pages to override application request validation settings, set the requestValidationMode attribute in the httpRuntime configuration section to requestValidationMode="2.0". Example: <httpRuntime requestValidationMode="2.0" />. After setting this value, you can then disable request validation by setting validateRequest="false" in the Page directive or in the <pages> configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. For more information, see http://go.microsoft.com/fwlink/?LinkId=153133.

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$Editor1$editortext="<P><BR></P>").

 

I have set the validateRequest="false" and that hasn't made any difference...

Hummm??  like I said - If i change the target frame work to 3.5 all is well but when i change it back to 4.0 - I get the big crash...

Oh!! I forgot to mention that if your going to target .net 4.0 then in your web.config you must add : <httpRuntime requestValidationMode="2.0"/>


This setting is important as it will allow you to override request validation in your page directive. It's a breaking change introduced in .net 4.0 by ASP.NET unfortunately.
When you use an html editor then you want to accept html content so automatic request validation brings nothing but problems. You must do your usual validation manually. I have tried in many ways to automate this process but the best way is for every developer to be aware and handle their own validation rules manually.


If you notice the default web.config file in the samples download, it contains the following settings, I encourage you to experiment with these settings :

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
	<system.web>
		<pages theme="classic">
		</pages>
		<httpRuntime requestValidationMode="2.0"/>
		<compilation debug="true" targetFramework="4.0">
		</compilation>
		<httpHandlers>
			<add verb="*" path="typps.axd" type="Typps.WebResourceHandler"/>
		</httpHandlers>
	</system.web>
	<system.webServer>
		<!--<validation validateIntegratedModeConfiguration="false"/>-->
		<handlers>
			<add verb="*" path="typps.axd" type="Typps.WebResourceHandler" name="WebResourceHandler" preCondition="integratedMode"/>
		</handlers>
	</system.webServer>
</configuration>

Notice the addition of <httpRuntime requestValidationMode="2.0"/> in the above sample web.config. This setting is important. I didn't automate this particular setting because I feel everybody must do this themselves manually. It's quite personal so instead I limit myself to mention this in the documenation that I am still currently authoring :P:P

It will be ready soon.

Alessandro

 

 

Sep 14, 2010 at 1:45 AM

Wow - That was it!!!!....

Thak you so VERY MUCH!!!  This is a great tool.  I really appreciate your immediate response!

and taking the time to work with me!

Coordinator
Sep 14, 2010 at 1:54 AM

phew! I am very happy too. Thank you for reporting back.

Alessandro