using C# dll methods in asp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AnuSumesh
    New Member
    • Aug 2007
    • 96

    #1

    using C# dll methods in asp

    Hi All,

    I have one dll written in c#. One of its methods return array of dictionary.
    I want to call and use that method in ASP file.
    I am using jscript in ASP.

    my code is a s follows:
    Code:
    <%
    var cls;
    cls=new ActiveXObject("shareaccessanu.FileOperations");
    var collection=cls.getdic();
    Response.write("type of  collection "+typeof(collection));
    %>
    the output is "unknown" i.i typeof returns unknown

    How can i use this?

    The dll name is shareaccessanu and it contains 3 different classes named Fileoperations, Share. Sharecollection .
    One of method of class Fileoperations returns array of class Share.
    How to use all these methods in Jscript.

    Plzzzz help me in above issues.
    I ll be fired if i will not complete the project.
    Its very urgent.

    Thanks,
    Anu
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    I know this isn't what you wanted to hear, but my suggestion is abandon asp, do this whole thing in .NET - then referencing an outside .dll is built-in.

    Jared

    Comment

    • AnuSumesh
      New Member
      • Aug 2007
      • 96

      #3
      I can't avoid ASP.
      My company already have some project which is using dll.
      I have to replca ethat dll with my dll which should support all exisitng dll functions.
      Even i dont know the functionality of some of existing dll functions

      Plzzzzz help

      Anu

      Comment

      • AnuSumesh
        New Member
        • Aug 2007
        • 96

        #4
        using C# dll methods in asp

        Hi All,

        I have created one dll in c# and using that dll in ASP programs. All dll methods are working fine ion ASP except one method that returns dictionary object.
        When i am calling that method in asp (using jscript), its giving error "object unknown".

        My asp code is as follows:

        Code:
        var cls=new ActiveXObject("shareaccessanu.FileOperations"); 
        //shareaccessanu is dll name
        var item=cls.UsrBrowseContent("D:\\Anu"); //method returns dictionary object
        Response.write("typeof= "+typeof(item)); //return "unknown"
        Can anyone please help me how can I use this method in ASP?
        Plzzzzzzzz its urgent.

        Thanks,
        ANU

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          Anu,

          1- Please don't double-post your questions. I have merged threads this time, but consider this a warning. Double posting is strictly prohibited by the Bytes site guidelines. Asking an expert to weigh in on a particular question that has gone unanswered is permitted.

          2- Please write your words out. When I see "plzzzzz" in a post my first response is "this poster is so lazy he can't even be bothered to write out 'please'. Why should I help someone that lazy?" This is a common gripe among forum mods and experts, we will all be similarly annoyed by your posts.

          3- I don't think any of us do what you are trying to do, the number of people who write asp is small enough, the number who write asp in javascript is a small fraction of that, and the number who include custom dlls in a classic asp page is staggeringly low. Nevertheless, from your last post, I see that the error given says the object is unrecognized. Which line is giving this error? The new object line or the UsrBrowseConten t line?

          Jared

          Comment

          • CroCrew
            Recognized Expert Contributor
            • Jan 2008
            • 564

            #6
            Hello AnuSumesh,

            Let’s see if we can figure this one out. Please post the code you’re using to call this method too. That might help out with finding a solution.

            CroCrew~

            Comment

            • AnuSumesh
              New Member
              • Aug 2007
              • 96

              #7
              Hi
              Thanks for considering my problem.

              DLL method code is as follows:

              Code:
              public Dictionary<string, string> AdmEnumerateDomains()
                      {
                          Dictionary<string, string> dic = new Dictionary<string, string>();
                          dic.Add("anu", "female");
                          return dic;
                      }
              ASP code(using jscript)
              Code:
              //dll is shareaccessanu and class name is FileOperations
              var cls;
              cls=new ActiveXObject("shareaccessanu.FileOperations"); 
              
              var collection=cls.AdmEnumerateDomains();
              Response.write("type of "+typeof(collection)); // result is "unknown"
              Thanks
              Anu

              Comment

              • CroCrew
                Recognized Expert Contributor
                • Jan 2008
                • 564

                #8
                Hello AnuSumesh,

                With the help of a good friend of mine (thanks Mike!) I came up with this:

                I ' m not sure what you're trying to get out of the typeof() operator.... it looks like it will only return six possible values: The typeof operator returns type information as a string. There are six possible values that typeof returns: "number," "string," "boolean," "object," "function," and "undefined. "

                It seems, and I've not tested this so I may be wrong, that since you've already returned the method and cast it as a var, it wouldn't really know what type of object it is....

                Can you do something like this? typeof(cls.AdmE numerateDomains ())?

                I would guess that doing that would return object, but I ' m not sure how helpful that is to you.

                Sorry I can't be more helpful. Kind of a goofy setup (C# dll being used by Jscript via a Classic ASP page).

                Comment

                • AnuSumesh
                  New Member
                  • Aug 2007
                  • 96

                  #9
                  Thanks a lot.

                  I have tried your option also but its also giving output "UNKNOWN".

                  Actually i want to call this method(returns dictionaryobjec t) in asp page.

                  Thanks,
                  Anu

                  Comment

                  • CroCrew
                    Recognized Expert Contributor
                    • Jan 2008
                    • 564

                    #10
                    Hello AnuSumesh,

                    Sorry I can't be more helpful in solving your problem. Like I said kind of a quirky setup you got there.

                    Hope you find a solution top your problem,
                    CroCrew~

                    Comment

                    Working...