Solved

.NET Remoting Problems!

Posted on 2004-08-04
2
211 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
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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