Solved

.NET Remoting Problems!

Posted on 2004-08-04
2
212 Views
Last Modified: 2010-05-18
Let me explain my situation:
I have a Server application (WinForm), it registered some Remote COMs (for example LoginControl(singleton)), LoginControl have a method to authenticate a user called Authenticate(). When a user starts the Client application (WinForm), the client application gets the LoginControl from the Server and then  calls the Authenticate method, assume that it's a valid user, how can I notify the Server application that there was a user logged in?Do I have to write some more remote COM to achieve this?
Thank you!
0
Comment
Question by:tinh911
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
PocketMatt earned 250 total points
ID: 11713781
Hi there

well.. there is a way.. i just don't know if this is the correct way for this...
i had the same situation with a web-component.. and well.. there is as far as i know no possibility to get the instance of your singleton object because it is created when someone opens a connection.

now... when i can not get the instance of a class.. why not just use the class itself?

like

public class AuthClass
{
    internal static event EventArgs UserLogin;
    public bool AuthUser(string Username, password)
    {
        bool RetVal;
        // your authentication stuff here assign value to RetVal
        if (RetVal)
        {
            AuthClass.OnUserLogin(this);
        }
        return RetVal;
    }
    private static void OnUserLogin(object sender)
    {
         if (UserLogin != null)
         {
               UserLogin(sender, EventArgs.Empty);
         }
    }
}

in the class just subscribe to the static event of the class and you'll recieve your LogIns

hope this helps
0
 

Author Comment

by:tinh911
ID: 11733108
I've tried it! It worked perfectly!
Thank you PocketMatt!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question