Solved

.NET Remoting Problems!

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
New to SOAP and need some direction 10 79
Filename to be appended with DateTimeof Download 3 55
Install Problem 13 29
What can cause the styling on a .NET site to not be found? 17 25
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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