JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to Call C#.net Dll in Java Script ??? Posted by chintan.desai on 6 Feb 2007 at 11:12 PM
Hi All Pals,
I m only 2 days older in javascript. Really frm 2 days i m seeking for :
How to Call C#.net Dll in Java Script ???
I need to call one method frm Class called Class1 and method call Fun() wich return one integer say 100.This val i need to catch in javascript variable just like

var val=Class1.Fun();
alert(val);

but i cud not do so.Pls help me

Help wud be appreciated

Regards
Chintan
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by zibadian on 7 Feb 2007 at 12:04 AM
: Hi All Pals,
: I m only 2 days older in javascript. Really frm 2 days i m seeking for :
: How to Call C#.net Dll in Java Script ???
: I need to call one method frm Class called Class1 and method call Fun() wich return one integer say 100.This val i need to catch in javascript variable just like
:
: var val=Class1.Fun();
: alert(val);
:
: but i cud not do so.Pls help me
:
: Help wud be appreciated
:
: Regards
: Chintan
:
That's only possible if the dll is a registered COM server. For more info see this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=18052 and msdn.microsoft.com
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by chintan.desai on 7 Feb 2007 at 4:15 AM
: : Hi All Pals,
: : I m only 2 days older in javascript. Really frm 2 days i m seeking for :
: : How to Call C#.net Dll in Java Script ???
: : I need to call one method frm Class called Class1 and method call Fun() wich return one integer say 100.This val i need to catch in javascript variable just like
: :
: : var val=Class1.Fun();
: : alert(val);
: :
: : but i cud not do so.Pls help me
: :
: : Help wud be appreciated
: :
: : Regards
: : Chintan
: :
: That's only possible if the dll is a registered COM server. For more info see this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=18052 and msdn.microsoft.com
:
-------------------------------------------------------------
Reply :

thank u friend.
It is working.But Can i call .net dll in javascript or vbscript.My project been cease due to this problem.Is ther no other solution Pls reply soon.thx again.
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by zibadian on 7 Feb 2007 at 5:02 AM
: : : Hi All Pals,
: : : I m only 2 days older in javascript. Really frm 2 days i m seeking for :
: : : How to Call C#.net Dll in Java Script ???
: : : I need to call one method frm Class called Class1 and method call Fun() wich return one integer say 100.This val i need to catch in javascript variable just like
: : :
: : : var val=Class1.Fun();
: : : alert(val);
: : :
: : : but i cud not do so.Pls help me
: : :
: : : Help wud be appreciated
: : :
: : : Regards
: : : Chintan
: : :
: : That's only possible if the dll is a registered COM server. For more info see this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=18052 and msdn.microsoft.com
: :
: -------------------------------------------------------------
: Reply :
:
: thank u friend.
: It is working.But Can i call .net dll in javascript or vbscript.My project been cease due to this problem.Is ther no other solution Pls reply soon.thx again.
:
No, since as said it in the other forum, that would be a huge security hole. It would even be possible to run any and all programs on someone else's computer without his knowledge.
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by chintan.desai on 7 Feb 2007 at 9:26 PM
This message was edited by chintan.desai at 2007-2-7 21:32:21

This message was edited by chintan.desai at 2007-2-7 21:27:9

: : : : Hi All Pals,
: : : : I m only 2 days older in javascript. Really frm 2 days i m seeking for :
: : : : How to Call C#.net Dll in Java Script ???
: : : : I need to call one method frm Class called Class1 and method call Fun() wich return one integer say 100.This val i need to catch in javascript variable just like
: : : :
: : : : var val=Class1.Fun();
: : : : alert(val);
: : : :
: : : : but i cud not do so.Pls help me
: : : :
: : : : Help wud be appreciated
: : : :
: : : : Regards
: : : : Chintan
: : : :
: : : That's only possible if the dll is a registered COM server. For more info see this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=18052 and msdn.microsoft.com
: : :
: : -------------------------------------------------------------
: : Reply :
: :
: : thank u friend.
: : It is working.But Can i call .net dll in javascript or vbscript.My project been cease due to this problem.Is ther no other solution Pls reply soon.thx again.
: :
: No, since as said it in the other forum, that would be a huge security hole. It would even be possible to run any and all programs on someone else's computer without his knowledge.
:
----------------------------------------------------
Reply:
Ok,thaxs for all replies.
Ok then can u tell me How to make .net dll as COM assembly?
I have done the following steps in .net visual studio 2005 IDE to register my .net dll as COM.
1)Project->Project property>build>and checking "Register for com interop" box
2)even use regasm and regsvr32 and tried to register.but cud not register

my idea is to make this com register and by using javascript i can call this com assembly.Again i can call javascript file in my flash.

pls reply if u know .net
but thax again
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by zibadian on 7 Feb 2007 at 10:15 PM
: This message was edited by chintan.desai at 2007-2-7 21:32:21

: This message was edited by chintan.desai at 2007-2-7 21:27:9

: : : : : Hi All Pals,
: : : : : I m only 2 days older in javascript. Really frm 2 days i m seeking for :
: : : : : How to Call C#.net Dll in Java Script ???
: : : : : I need to call one method frm Class called Class1 and method call Fun() wich return one integer say 100.This val i need to catch in javascript variable just like
: : : : :
: : : : : var val=Class1.Fun();
: : : : : alert(val);
: : : : :
: : : : : but i cud not do so.Pls help me
: : : : :
: : : : : Help wud be appreciated
: : : : :
: : : : : Regards
: : : : : Chintan
: : : : :
: : : : That's only possible if the dll is a registered COM server. For more info see this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=18052 and msdn.microsoft.com
: : : :
: : : -------------------------------------------------------------
: : : Reply :
: : :
: : : thank u friend.
: : : It is working.But Can i call .net dll in javascript or vbscript.My project been cease due to this problem.Is ther no other solution Pls reply soon.thx again.
: : :
: : No, since as said it in the other forum, that would be a huge security hole. It would even be possible to run any and all programs on someone else's computer without his knowledge.
: :
: ----------------------------------------------------
: Reply:
: Ok,thaxs for all replies.
: Ok then can u tell me How to make .net dll as COM assembly?
: I have done the following steps in .net visual studio 2005 IDE to register my .net dll as COM.
: 1)Project->Project property>build>and checking "Register for com interop" box
: 2)even use regasm and regsvr32 and tried to register.but cud not register
:
: my idea is to make this com register and by using javascript i can call this com assembly.Again i can call javascript file in my flash.
:
: pls reply if u know .net
: but thax again
:
Have you defined and implemented the interfaces correctly? I know very little about COM or .NET, but I do know that it often requires a rewrite of the type definitions to add the COM-interfaces instead of the exported functions. Perhaps people in the C#-board can help you better.
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by chintan.desai on 12 Feb 2007 at 11:08 PM
No probs.I got the solution.
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by Luna7 on 5 Apr 2007 at 5:56 AM
: No probs.I got the solution.
:
Hi,

I have exactly the same problem.

I wrote a Com Assembly with C#, registered it with regasm and pushed it into the gac with gacutil successful.
So far so good.

Now I have to use it in Javascript
I tried it like this:
function lib ()
{
alert("here i am");
try
{
var test = MyLib.Class1.info(); //Namespace.Class.Function
alert ("Test: "+test);
}
catch (e)
{
alert("exc "+e.message);
}

}
e. message is: MyLib is undefined
What did I wrong?
Can you help me please? Or show me your solution?
thx!
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by hendyhanusin on 2 Apr 2007 at 10:53 PM
Dear friend,

i encounter same problem.
so i have created a .NET DLL Class Library.
But i don't know how to call and use this DLL method, event in JavaScript ?
Could you help ?

2.
other solution is we have to re-build the DLL using VB 6.0 , but it's funny since we're already using VB .NET.

Tks,
hendy
---------my source code in windows application----------------

.........
Private _AddListHandler As ACR120DLL.ACR120DLL.AddListHandler
Private WithEvents _ACR As ACR120DLL.ACR120DLL


_ACR = New ACR120DLL.ACR120DLL
_ACR.TotalBlocks = 44 'TOTAL BLOCK-1
AddHandler _ACR.AddList, AddressOf AddList
AddHandler _ACR.SelectList, AddressOf SelectList
_ACR.Connect()

Timer1 = New System.Timers.Timer
AddHandler Timer1.Elapsed, AddressOf TriggerReadData
Timer1.Interval = 1000
Timer1.AutoReset = True
Timer1.Start()

...........

Private Sub AddList(ByVal Msg As String)
If Msg.EndsWith("-3030") Then
MessageBox.Show("Ada kesalahan ! Mohon diulangi proses pembacaan kartu !")
Return
End If
List1.Items.Add(Msg)

End Sub

Private Sub SelectList()
List1.SelectedIndex = List1.Items.Count - 1
End Sub

Private Sub TriggerReadData(ByVal o As Object, ByVal e As System.Timers.ElapsedEventArgs)

End Sub





Report
Re: How to Call C#.net Dll in Java Script ??? Posted by danish_ssuet on 16 Feb 2008 at 2:13 PM
: Dear friend,
:
: i encounter same problem.
: so i have created a .NET DLL Class Library.
: But i don't know how to call and use this DLL method, event in
: JavaScript ?
: Could you help ?
:
: 2.
: other solution is we have to re-build the DLL using VB 6.0 , but
: it's funny since we're already using VB .NET.
:
: Tks,
: hendy
: ---------my source code in windows application----------------
:
: .........
: Private _AddListHandler As ACR120DLL.ACR120DLL.AddListHandler
: Private WithEvents _ACR As ACR120DLL.ACR120DLL
:
:
: _ACR = New ACR120DLL.ACR120DLL
: _ACR.TotalBlocks = 44 'TOTAL BLOCK-1
: AddHandler _ACR.AddList, AddressOf AddList
: AddHandler _ACR.SelectList, AddressOf SelectList
: _ACR.Connect()
:
: Timer1 = New System.Timers.Timer
: AddHandler Timer1.Elapsed, AddressOf TriggerReadData
: Timer1.Interval = 1000
: Timer1.AutoReset = True
: Timer1.Start()
:
: ...........
:
: Private Sub AddList(ByVal Msg As String)
: If Msg.EndsWith("-3030") Then
: MessageBox.Show("Ada kesalahan ! Mohon diulangi proses
: pembacaan kartu !")
: Return
: End If
: List1.Items.Add(Msg)
:
: End Sub
:
: Private Sub SelectList()
: List1.SelectedIndex = List1.Items.Count - 1
: End Sub
:
: Private Sub TriggerReadData(ByVal o As Object, ByVal e As
: System.Timers.ElapsedEventArgs)
:
: End Sub
:
:
:
:
:
: name : danish
email : danish85_dj@hotmail.com
Friend, i have a great solution of this problem, use AJAX.NET library, don't worry, this library is very simple to use, this library has the ability to use ServerSide functions (C#,VB.NET) function using JAVASCRIPT.
download this library and enjoy it, i hope this will be very useful to u.




Report
Re: How to Call C#.net Dll in Java Script ??? Posted by am_po on 7 Aug 2008 at 1:42 AM
Hi.

Does it work for you (using C# dll by javascript)?
Still fighting with this...

Thanks.
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by rap5kor on 9 Jan 2009 at 5:02 AM
you can do this by using AJAX technology. but the C# code will get executed at the server side only
Report
Re: How to Call C#.net Dll in Java Script ??? Posted by shivavodnala on 8 Jun 2009 at 2:31 AM
We can dll C# function as follows

Add Dll referrence to your application and in design page add following code

e.g . consider GetDate.dll having "Date" as a class
<script language="javascript" type="text/javascript" >
<%
//Creating object for Date class
Getdate.Date dt=new Getdate.Date();

%>

// Calling C# function from Dll
var date='<%=dt.GetDate() %>'
alert(date)
</script>




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.