Solved

.NET Remoting Problems!

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now