Solved

Windows application responding to wrong user account through socket

Posted on 2014-03-26
5
247 Views
Last Modified: 2014-04-15
Hi Experts,

I have an issue where I have a simple application that exposes a web server for inter-process communication.  This application is meant for a single user to make requests to it.  It is not a windows service.

If someone logs out, no problem.  The application is shut down and so the web server goes away.  But if someone uses the user switching functionality - the application remains and will respond to requests that come in on that port from a separate user account.

How can I fix this?

Thanks for any ideas!
Mike
0
Comment
Question by:thready
[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
  • 3
  • 2
5 Comments
 
LVL 34

Expert Comment

by:sarabande
ID: 39956504
your webserver could register to receive a WM_WTSSESSION_CHANGE message.

see
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776893(v=vs.85).aspx

then it could end or deny requests until the user was switched back.

Sara
0
 
LVL 1

Author Comment

by:thready
ID: 39956513
Thanks Sara, you're brilliant as usual.  But I forgot to mention another thing.  It's also possible to have terminals connected where 2 users are actively using the machine.  What about that scenario?
0
 
LVL 34

Accepted Solution

by:
sarabande earned 500 total points
ID: 39956819
you probably need to establish two webservers one for each account. the webservers then would need an own port to listen for each account. you may define a user environment variable for the port and pass it to web server at creation time.

Sara
0
 
LVL 1

Author Closing Comment

by:thready
ID: 39958771
Thanks
0
 
LVL 1

Author Comment

by:thready
ID: 40002385
Hi again Sara,

I'm looking again at your first comment - do you know if the session state change event for WM_WTSSESSION_CHANGE is always WTS_CONSOLE_DISCONNECT and WTS_CONSOLE_CONNECT for when the user switches?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

752 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