Ask a questionAsk a question
 

Question Microsoft.PointOfService

  • Thursday, October 01, 2009 1:23 PMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi all,

    I'm writing a POS Web application under Windows XP with .NET 2.0. I have an Epson TM-T88IV thermal printer where I downloaded and installed both Microsoft POS for .NET 1.11 and Epson OPOS for .NET 1.11.6. I wrote the following testing ActiveX control:

    using System;<br/>
    using System.Collections;<br/>
    using System.ComponentModel;<br/>
    using System.Drawing;<br/>
    using System.Data;<br/>
    using System.Reflection;<br/>
    using System.Runtime.CompilerServices;<br/>
    using System.Security;<br/>
    using System.Security.Permissions;<br/>
    using System.Windows.Forms;<br/>
    using Microsoft.PointOfService;<br/>
    <br/>
    [assembly: AssemblyVersion("1.0.0.6")]<br/>
    [assembly: AllowPartiallyTrustedCallers]<br/>
    namespace printer<br/>
    {<br/>
        /// &ltsummary><br/>
        /// Summary description for rtfcontrol.<br/>
        /// </summary><br/>
        public class ThermalPrinter : System.Windows.Forms.UserControl<br/>
        {<br/>
            private System.Windows.Forms.Button btnPrint;<br/>
            /// &ltsummary><br/>
            /// Required designer variable.<br/>
            /// </summary><br/>
            private System.ComponentModel.Container components = null;<br/>
    <br/>
            public ThermalPrinter()<br/>
            {<br/>
                // This call is required by the Windows.Forms Form Designer.<br/>
                InitializeComponent();<br/>
            }<br/>
    <br/>
            /// &ltsummary><br/>
            /// Clean up any resources being used.<br/>
            /// </summary><br/>
            protected override void Dispose(bool disposing)<br/>
            {<br/>
                if (disposing)<br/>
                {<br/>
                    if (components != null)<br/>
                        components.Dispose();<br/>
                }<br/>
                base.Dispose(disposing);<br/>
            }<br/>
    <br/>
            #region Component Designer generated code<br/>
            /// &ltsummary><br/>
            /// Required method for Designer support - do not modify <br/>
            /// the contents of this method with the code editor.<br/>
            /// </summary><br/>
            private void InitializeComponent()<br/>
            {<br/>
                this.btnPrint = new System.Windows.Forms.Button();<br/>
                this.SuspendLayout();<br/>
                // <br/>
                // btnPrint<br/>
                // <br/>
                this.btnPrint.Location = new System.Drawing.Point(80, 48);<br/>
                this.btnPrint.Name = "btnPrint";<br/>
                this.btnPrint.Size = new System.Drawing.Size(108, 36);<br/>
                this.btnPrint.TabIndex = 0;<br/>
                this.btnPrint.Text = "Print";<br/>
                this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);<br/>
    <br/>
                this.Controls.AddRange(new Control[] { btnPrint });<br/>
    <br/>
                this.Load += new System.EventHandler(this.frmStep1_Load);<br/>
                this.ResumeLayout(false);<br/>
    <br/>
            }<br/>
            #endregion<br/>
    <br/>
            /// <summary><br/>
            /// PosPrinter object<br/>
            /// </summary><br/>
            PosPrinter m_Printer = null;<br/>
    <br/>
            /// <summary><br/>
            ///  A method "Print" calls some another method.<br/>
            ///  They are method for printing.<br/>
            /// </summary><br/>
            /// <param name="sender"></param><br/>
            /// <param name="e"></param><br/>
            private void btnPrint_Click(object sender, System.EventArgs e)<br/>
            {<br/>
                //<<<step1>>> Start<br/>
                try<br/>
                {<br/>
                    //As using the PrintNormal method, send strings to a printer, and print it<br/>
                    //[\n] is the standard code for starting a new line.<br/>
                    m_Printer.PrintNormal(PrinterStation.Receipt, "Hello OPOS for .Net\n");<br/>
                }<br/>
                catch (PosControlException)<br/>
                {<br/>
                }<br/>
                //<<<step1>>> End<br/>
            }<br/>
    <br/>
            /// <summary><br/>
            /// When the method "changeButtonStatus" was called,<br/>
            /// all buttons other than a button "closing" become invalid.<br/>
            /// </summary><br/>
            private void ChangeButtonStatus()<br/>
            {<br/>
                btnPrint.Enabled = false;<br/>
            }<br/>
    <br/>
            /// <summary><br/>
            /// The processing code required in order to enable to use of service is written here.<br/>
            /// </summary><br/>
            /// <param name="sender"></param><br/>
            /// <param name="e"></param><br/>
            [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]<br/>
            private void frmStep1_Load(object sender, System.EventArgs e)<br/>
            {<br/>
                //<<<step1>>>--Start<br/>
                //Use a Logical Device Name which has been set on the SetupPOS.<br/>
                string strLogicalName = "ThermalPrinter";<br/>
    <br/>
                try<br/>
                {<br/>
                    //Create PosExplorer<br/>
                    PosExplorer posExplorer = new PosExplorer();<br/>
    <br/>
                    DeviceInfo deviceInfo = null;<br/>
    <br/>
                    try<br/>
                    {<br/>
                        deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);<br/>
                        m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);<br/>
                    }<br/>
                    catch (Exception err)<br/>
                    {<br/>
                        MessageBox.Show("Exception", err.Message);<br/>
                        ChangeButtonStatus();<br/>
                        return;<br/>
                    }<br/>
    <br/>
                    //Open the device<br/>
                    m_Printer.Open();<br/>
    <br/>
                    //Get the exclusive control right for the opened device.<br/>
                    //Then the device is disable from other application.<br/>
                    m_Printer.Claim(1000);<br/>
    <br/>
                    //Enable the device.<br/>
                    m_Printer.DeviceEnabled = true;<br/>
                }<br/>
                catch (PosControlException)<br/>
                {<br/>
                    ChangeButtonStatus();<br/>
                }<br/>
                //<<<step1>>>--End<br/>
            }<br/>
        }<br/>
    }
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="Test.Default" %><br/>
    <br/>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br/>
    <html xmlns="http://www.w3.org/1999/xhtml"><br/>
    <head runat="server"><br/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><br/>
        <title>Test</title><br/>
    </head><br/>
    <body><br/>
        <form id="form1" runat="server"><br/>
            <div><br/>
    	<object id="rtfcontrol" height="472" width="488"<br/>
             classid="../../ThermalPrinter.dll#printer.ThermalPrinter"><br/>
         </object><br/>
            </div><br/>
        </form><br/>
    </body><br/>
    </html><br/>
    
    
    At first, when I run the program in a remote PC, I got the following error message:
    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
    at System.Security.CodeAccessPermission.Demand()
    at System.Environment.GetFolderPath(SpecialFolder folder)
    at Microsoft.PointOfService.InternalLogger.Initialize()
    at Microsoft.PointOfService.InternalLogger..ctor()
    at Microsoft.PointOfService.Logger.get_s_logger()
    at Microsoft.PointOfService.Logger.Info(String caller, String message)
    at Microsoft.PointOfService.PosExplorer..ctor()
    at devhood.ThermalPrinter.frmStep1_Load(Object sender, EventArgs e)
    at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
    at System.Windows.Forms.UserControl.OnCreateControl()
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message& m)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
    at System.Windows.Forms.UserControl.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.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)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.Permissions.FileIOPermission
    The Zone of the assembly that failed was:
    MyComputer


    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    ThermalPrinter
    Assembly Version: 1.0.0.1
    Win32 Version: n/a
    CodeBase: http://192.168.1.2:424/ThermalPrinter.DLL
    ----------------------------------------
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    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.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Microsoft.PointOfService
    Assembly Version: 1.11.0.0
    Win32 Version: 1.11.1139.0
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.PointOfService/1.11.0.0__31bf3856ad364e35/Microsoft.PointOfService.dll
    ----------------------------------------
    Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    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
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
    <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.
    After I made some changes with the coding and set the strong named dll in .NET Framework 2.0 Configuration with Full Trust, the Internet Explorer just frozen and I need to kill the Internet Explorer in Windows Task Manager. Anyone knows how can I solve this problem?

    Thanks,
    John

All Replies

  • Thursday, October 01, 2009 8:20 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    It's a bit of a long shot, but try passing 'this' into the constructor of PosExplorer when you create it. It's possible the hang is some kind of threading issue, and by providing a reference to your control to the PosExplorer constructor, PosExplorer should then internally invoke to the correct thread before doing various things, like raising events etc.
  • Friday, October 02, 2009 11:38 AMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Yort,

    Thanks for your suggestion. I tried to pass 'this' into PosExplorer but it still doesn't work...

    John
  • Saturday, October 03, 2009 8:24 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Can you put in some logging or tracing to determine which line is causing it to hang ?
  • Saturday, October 03, 2009 10:48 PMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    As I mentioned before, it's
    PosExplorer posExplorer = new PosExplorer(this);
    

  • Saturday, October 03, 2009 11:55 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry, my short term memory is clearly failing.

    Can you create a console or windows forms app that does the same thing and run it on the same server/pc and see what the result is ? I haven't ever used Pos .Net from ASP .Net (although I understand other people have) and it might be helpful to know if the problem is related to ASP .Net or not.
  • Wednesday, October 21, 2009 6:39 AMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I tried to run a windows forms application on the same pc without any problem...will that be something related to security settings?
  • Wednesday, October 21, 2009 7:33 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It's possible, but I don't know for sure.

    You could test it by changing the account the ASP .Net worker process runs under to an admin account (just as a temporary measure to see if it solves the problem... I wouldn't recommend that for production code).
  • Wednesday, October 21, 2009 9:32 PMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    How and where can I change it? I should change it in client or server pc? Because I'm not really familiar with the security bit, it will be great if you can give me some hints on that.

    Thanks.
  • Wednesday, October 21, 2009 10:13 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I'm not all that familiar with ASP .NET development myself, haven't done it for a few years now and I was never an expert.

    Having said that, the ASP .Net is a server process (it runs inside or alongside the web server), I don't believe there is an ASP .Net worker process on the client, so yes, you need to change it on the server. I can't remember exactly how you configure it... might be you go to the service control panel applet, properties on the asp .net process and then change it there. Google for asp .net worker account and you should get some good info.
  • Friday, October 30, 2009 3:32 AMSylvester-MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Does your web server have the permissions needed to access the devices?

  • Friday, October 30, 2009 3:49 AMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi John,

    Did you try changing the Asp .Net user permissions like I suggested ?

    Sylvester... what permissions are required to access the devices and where would they be assigned ? That is likely useful information to publish somewhere for devs trying to use Pos .Net inside ASP .Net.

  • Friday, October 30, 2009 11:29 PMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Yort,

    Sorry that didn't get you a reply for a long time. I'm busying on something else so I don't have time to test it again, I will give it a try and let you know the result.

    Sylvester, yes, it will be highly appreciate if you can give me some more guidance on this.

    Thanks heaps!

    John
  • Saturday, October 31, 2009 1:04 PMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I tried to add the following line in web.config but without any luck:

    <identity impersonate ="true" userName ="IUSR_MACHINENAME" password ="SomePassword"/>

    I tried to add the above line and restart my IIS. When I run the application, it just shown up the .net error message.

    Actually I didn't change the password for the IUSR account as I'm not sure whether it's appropriate to do it, so I just use the Metabase Explorer in  IIS 6.0 Resource Kits to retrieve the auto generated password.

    Yort and Sylvester, any ideas from you both?

    Here is the latest error message I got:

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.
    
    ************** Exception Text **************
    System.Security.SecurityException: Request failed.
       at devhood.ThermalPrinter.frmStep1_Load(Object sender, EventArgs e)
       at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
       at System.Windows.Forms.UserControl.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.UserControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.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)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.PermissionSet
    The Zone of the assembly that failed was:
    MyComputer
    
    
    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    ThermalPrinter
        Assembly Version: 1.0.0.4
        Win32 Version: n/a
        CodeBase: http://192.168.1.3:424/ThermalPrinter.DLL
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        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.42 (RTM.050727-4200)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Microsoft.PointOfService
        Assembly Version: 1.11.0.0
        Win32 Version: 1.11.1139.0
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.PointOfService/1.11.0.0__31bf3856ad364e35/Microsoft.PointOfService.dll
    ----------------------------------------
    Accessibility
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        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
    ----------------------------------------
    
    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.
    
    For example:
    
    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    
    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.
    
    
    
    Any ideas will be appreciated, thanks!

  • Sunday, November 01, 2009 1:10 AMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    Seems like a code access security issue. I'm not particularly clued up on this but you might be able to make it work if you use caspol.exe (Google for the correct options), or download the .Net SDK and use the control panel applet it installed. Grant the assembly that is doing the device work (and perhaps the pos .net assemblies too) 'full trust' using caspol.exe or the control panel applet and see if that helps.

    Otherwise, try what I said before and actually change the permissions on the asp .net user account (I don't think the impersonation line you put in the config file is quite the same thing). If it is a code access security issue, that may or may not help... you may still have to 'trust' the assemblies.

  • Sunday, November 01, 2009 3:57 PMjohn.lam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Finally I got rid of the above error but got a new error:

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.
    
    ************** Exception Text **************
    System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
       at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.CodeAccessPermission.Demand()
       at System.Environment.GetFolderPath(SpecialFolder folder)
       at devhood.ThermalPrinter.frmStep1_Load(Object sender, EventArgs e)
       at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
       at System.Windows.Forms.UserControl.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.UserControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.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)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.Permissions.FileIOPermission
    The Zone of the assembly that failed was:
    MyComputer
    
    
    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    ThermalPrinter
        Assembly Version: 1.0.0.2
        Win32 Version: n/a
        CodeBase: http://192.168.1.3:424/ThermalPrinter.DLL
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        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.42 (RTM.050727-4200)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Microsoft.PointOfService
        Assembly Version: 1.11.0.0
        Win32 Version: 1.11.1139.0
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.PointOfService/1.11.0.0__31bf3856ad364e35/Microsoft.PointOfService.dll
    ----------------------------------------
    Accessibility
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.42 (RTM.050727-4200)
        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
    ----------------------------------------
    
    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.
    
    For example:
    
    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    
    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

    It seems PointOfService is looking for (or writing) something in the Application Data folder but I don't have access to it...

    I've granted the assembly with full trust as well as
    <trust level="Full" originUrl=""/>
    in Web.config (I think it's a way to change the code access security? please correct me if I was worng)
  • Sunday, November 01, 2009 6:01 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi John,

    That may work for Asp .Net applications, I've never done it that way.

    Have you tried granting permissions to the app data folder and it's sub-folders to the asp net/iusr accounts (in Windows Explorer -> Properties of the app data folder -> Security tab) ?

  • Sunday, November 01, 2009 6:02 PMYortAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    To be honest, that error actually still looks like a code-access-security denial rather than a file system access denial, but I'm only guessing. Try assigning permissions in the file system, if that doesn't work then you might need to look at otherways of trusting the assembly.

    You *might* also get more help if you post about this error in the asp .net forum (presumably other asp .net devs will have had the same sort of issue with other libraries), but make the post more about the security exception than the use of Pos .Net/printer... just so they don't move that thread back here again.