Page view counter

Accessing c# dll from GAC in client side asp.net page

Last post 04-21-2008 8:06 AM by NC01. 5 replies.

Sort Posts:

  • Accessing c# dll from GAC in client side asp.net page

    02-29-2008, 4:29 AM
    • Loading...
    • ram123
    • Joined on 02-21-2008, 11:46 AM
    • Posts 1
    • Points 0

    Hi,

    I have C# windows control libarary (Dll), which I could able to load them
    into browser using <object> tag with following syntax (In aspx page) and user
    able to see the page properly.

    <object name="chk" id="chk" classid="http:GSIM.dll#GSIM.gsimManager"></object>

    But we would like to load a client C# windows control libarary instead of
    from webserver. Assume that the libarary avilalble in client GAC.

    Is there anyway I can mention in my <object> tag to load the control from
    client location instead of from web server ?

    Looking forward for your suggestion.

    Thanks

  • Re: Accessing c# dll from GAC in client side asp.net page

    02-29-2008, 11:23 AM
    Answer
    • Loading...
    • NC01
    • Joined on 08-26-2005, 3:33 PM
    • Posts 13,275
    • Points 71,391
    • TrustedFriends-MVPs

    Here is how to call a simple ActiveX object installed on the client.

    ///////////////////////////////////////////////////////////////////////////////////
    // AxComp.cs
    // Creates a simple ActiveX component.
    //
    // 1. Compile into a class library, or use:
    //    csc /t:library AxComp.cs
    // 2. Register and generate the Typelib on the client's machine with:
    //    regasm AxComp.dll /tlb:AxCompNet.dll /codebase
    ///////////////////////////////////////////////////////////////////////////////////

    using System;
    using System.Runtime.InteropServices;

    namespace AxComponent
    {
     public interface IAxTest
     {
      string CallIt();
     }

     [ClassInterface(ClassInterfaceType.AutoDual)]
     public class AxComp : IAxTest
     {
      public string CallIt()
      {
       return "This is a test.";
      }
     }
    }

    ///////////////////////////////////////////////////////////////////////////////////
    // Tester.htm
    // Test the ActiveX component.
    ///////////////////////////////////////////////////////////////////////////////////

    <html>
    <head>
    <script language=JavaScript>
    var g_axComponent = new ActiveXObject('AxComponent.AxComp');
    alert(g_axComponent.CallIt());
    </script>
    </head>
     <body>
      <h1>Tester.htm</h1>
     </body>
    </html>

    Here is a link that might help: http://aspnet.4guysfromrolla.com/articles/052604-1.aspx

    NC...

     

  • Re: Accessing c# dll from GAC in client side asp.net page

    04-11-2008, 12:02 AM
    • Loading...
    • das.dwipayan
    • Joined on 03-14-2008, 8:57 AM
    • Hyderabad
    • Posts 52
    • Points 38

    Hi

       I followed your path and created the C# dll and register in using Regasm and it is working fine when i call the dll methods from the HTML .

      But

      When i copied the same dll to other machine and registered it with Regasm tool and calling from HTML .It is not working.

     What is the reason after registraion on clients machine it is not called from the HTML file.

     

     

     

     

    Thanks & Regards
    Dwipayan Das
    Software engineer
  • Re: Accessing c# dll from GAC in client side asp.net page

    04-11-2008, 7:39 AM
    • Loading...
    • NC01
    • Joined on 08-26-2005, 3:33 PM
    • Posts 13,275
    • Points 71,391
    • TrustedFriends-MVPs

    Could be you need to tweak the properties of the browser.

    In the Browser Toolbar:
    Tools -> Internet Options -> choose the Security tab
    Click the Custom Level button
    Enable the following settings:
     Run ActiveX controls and plug-ins
     Initialize and script ActiveX control not marked as safe.

    NC...

     

  • Re: Accessing c# dll from GAC in client side asp.net page

    04-16-2008, 11:12 PM
    • Loading...
    • das.dwipayan
    • Joined on 03-14-2008, 8:57 AM
    • Hyderabad
    • Posts 52
    • Points 38

    Thanks for the answering and giving me the trick.

    Thanks & Regards
    Dwipayan Das
    Software engineer
  • Re: Accessing c# dll from GAC in client side asp.net page

    04-21-2008, 8:06 AM
    • Loading...
    • NC01
    • Joined on 08-26-2005, 3:33 PM
    • Posts 13,275
    • Points 71,391
    • TrustedFriends-MVPs

    Glad to be of help!

    NC...

     

Page 1 of 1 (6 items)