Other facets of the Client/Server problem

Discussion in 'ASP .Net' started by pamelafluente@libero.it, Jul 2, 2006.

  1. Guest

    I am exploring also the Smart Client approach for my Client/server
    problems.
    I have written this (CLIENT SIDE)

    '--------------------------
    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click

    'Here I call a remote method from my client application

    Dim ServerURL As String = "http://YourUrl/Server.exe"

    Try
    Dim Assembly As System.Reflection.Assembly =
    System.Reflection.Assembly.LoadFrom(ServerURL)

    'first call
    Dim NameRemoteClass1 As String = "Server.Form1"
    Dim Type1 As Type = Assembly.GetType(NameRemoteClass1)
    Dim MyRemoteClass1 As Form =
    DirectCast(Activator.CreateInstance(Type1), Form)
    MyRemoteClass1.Show()
    Type1.GetMethod("DrawSomething").Invoke(MyRemoteClass1,
    Nothing)

    'second call (parameterized)
    Dim NameRemoteClass2 As String = "Server.MyRemoteClass"
    Dim Type2 As Type = Assembly.GetType(NameRemoteClass2)
    Dim MyRemoteClass2 As Object =
    Activator.CreateInstance(Type2)
    Type2.GetMethod("SayThis").Invoke(MyRemoteClass2, New
    Object() {"Hello group"})

    Catch ex As Exception
    MsgBox(ex.Message)
    End Try

    End Sub

    End Class
    '--------------------------

    and on the server I have put this (SERVER.EXE):

    '--------------------------
    Public Class Form1

    Sub DrawSomething()
    Dim g As Graphics = Me.CreateGraphics
    g.FillEllipse(Brushes.Blue, _
    New Rectangle(10, 10, 200, 100))
    End Sub

    End Class

    Public Class MyRemoteClass

    Sub SayThis(ByVal ThingToSay As String)
    MsgBox(ThingToSay)
    End Sub

    End Class
    '--------------------------

    This works fine. My questions:

    - Can I get a similar result having the form running within a Web page?
    (like an applet?)
    - Also is there a wat to remove the security warning?
    - How do I taljk back to my server program ?

    -Pam
    , Jul 2, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nate
    Replies:
    4
    Views:
    481
  2. David List
    Replies:
    0
    Views:
    294
    David List
    Aug 6, 2003
  3. Roger Leigh
    Replies:
    4
    Views:
    458
    Roger Leigh
    Nov 12, 2003
  4. Replies:
    0
    Views:
    84
  5. Replies:
    0
    Views:
    79
Loading...

Share This Page