TChart in WinForms control not working in ASP.NET

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Mark
Newbie
Newbie
Posts: 5
Joined: Fri Dec 16, 2005 12:00 am
Location: England

TChart in WinForms control not working in ASP.NET

Post by Mark » Tue Aug 05, 2008 3:16 pm

I have an existing Windows Control Library application which uses TeeChart .NET 2 and is working fine, however I have recently tried to get my WinForms control to work in an ASP.NET application without success.

I went back to basics and created a simple Control with a TChart on it but it just won't display in IE.

Do you know if this should work or am I wasting my time? I don't really want to have to rewrite the application using the WebChart control.

Any help appreciated.

Thanks
Mark

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Re: TChart in WinForms control not working in ASP.NET

Post by Christopher » Wed Aug 06, 2008 7:30 am

Hello Mark,
Mark wrote:I have an existing Windows Control Library application which uses TeeChart .NET 2 and is working fine, however I have recently tried to get my WinForms control to work in an ASP.NET application without success.

I went back to basics and created a simple Control with a TChart on it but it just won't display in IE.

Do you know if this should work or am I wasting my time? I don't really want to have to rewrite the application using the WebChart control.
If it worked in teechart.net v2 it should work in teechart.net v3. Maybe the new "manual" double buffering in v3 is the problem. You can turn this off using the line:

Code: Select all

tChart1.Graphics3D.UseBuffer = false;
However, this may cause rather unsightly rendering, depending on the circumstances. To overcome this, you could derive your own control and turn DoubleBuffered to true (in >= .net 2.0), e.g.

Code: Select all

  public partial class Form3 : Form
  {
    public Form3()
    {
      InitializeComponent();
      InitializeChart();
    }

    private Steema.TeeChart.Styles.Candle series;
    private MyTChart tChart1;

    private void InitializeChart()
    {
      tChart1 = new MyTChart();
      tChart1.Dock = DockStyle.Fill;
      this.Controls.Add(tChart1);
      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(series = new Candle());
      series.FillSampleValues();
    }
  }

  public class MyTChart : TChart
  {
    public MyTChart()
      : base()
    {
      base.Graphics3D.UseBuffer = false;
      base.DoubleBuffered = true;
    }
  }
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Mark
Newbie
Newbie
Posts: 5
Joined: Fri Dec 16, 2005 12:00 am
Location: England

Post by Mark » Wed Aug 06, 2008 8:35 am

Thanks for the quick reply Christopher,

I am not sure what the cause of my original problem was because I never had any kind of error message displayed but I have changed my simple test app to use your example and I now get an unhandled exception from:

Steema.TeeChart.FrAccessProvider..ctor()

The details for the exception are:

Code: Select all

************** Exception Text **************
System.MethodAccessException: Steema.TeeChart.FrAccessProvider..ctor() ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
   at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
   at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
   at System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh)
   at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh)
   at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
   at System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
   at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext)
   at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.ReflectionPermission
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, Object[] args)
   at System.SecurityUtils.SecureCreateInstance(Type type, Object[] args)
   at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
   at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
   at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
   at Steema.TeeChart.Chart..ctor()
   at Steema.TeeChart.TChart..ctor()
   at winconlib.MyTChart..ctor()
   at winconlib.Form1.InitializeChart()
   at winconlib.Form1..ctor()
   at winconlib.UserControl1.button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
winconlib
    Assembly Version: 1.0.3140.14846
    Win32 Version: n/a
    CodeBase: http://localhost/apvtest/winconlib.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Microsoft.mshtml
    Assembly Version: 7.0.3300.0
    Win32 Version: 7.0.3300.0
    CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
----------------------------------------
TeeChart
    Assembly Version: 2.0.2987.19069
    Win32 Version: n/a
    CodeBase: http://localhost/APVTest/TeeChart.DLL
----------------------------------------
The test app is very simple, its just an html page that display the user control, the user control has one button on it which opens the form. The form code is as per your example.

I'm using TeeChart for .NET v2, the Runtime version is v2.0.50727 and the Version is 2.0.2987.19069. The winforms control was created in VS2005 and I'm running on WinXP Pro.

Regards
Mark

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Aug 06, 2008 8:59 am

Hello Mark,
Mark wrote: The test app is very simple, its just an html page that display the user control, the user control has one button on it which opens the form. The form code is as per your example.

I'm using TeeChart for .NET v2, the Runtime version is v2.0.50727 and the Version is 2.0.2987.19069. The winforms control was created in VS2005 and I'm running on WinXP Pro.
Ah, I'm sorry, I had it in my mind that it had worked fine for you in teechart.net v2 but now didn't work for you in teechart.net v3. My mistake. Please disregard my last answer :)

I'll look into the issue from this end and will get back to you with something.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Thu Aug 07, 2008 12:02 pm

Hello Mark,

We had run earlier tests on this type of setup with some degree of success, loading the TeeChart in a UserControl to a webpage. We've re-run tests now to see if we could shed any light on the license errors you've encountered but have been now been unable to show even an empty UserControl in a web browser, run across several machines! We're using Vista and Win2003 for tests, we'll locate an XP machine on which to re-run the test.

One of the problems we came across in earlier tests was application susceptibility to security settings on each machine and IE setup. You may find that in itself makes rollout of this type of application a little difficult. From that perspective we don't recommend this application architecture for production applications.

If you'd like to take your tests further, though we've been unable to successfully run a test here we have read possibilities into the error log you've sent over, to avoid holding you up you could mail sales at steema.com quoting this thread for them to send you download details for the plugin release of TeeChart. The plugin version allows you to bind the license at an assembly level (ie. the UserControl assembly level) and thus, hopefully avoid it's recall when in IE (higher level calling exe).

Regards,
Marc Meumann
Steema Support

Post Reply