4

Environment:

We are having a Website and a separate ASMX - Web Service sharing the same database (MS SQL 2008). Web Service is serving the Mobile Apps at the moment. Projects are done using c#, Asp.Net, 3.5 framework, VS 2008.

Requirement:

We need to avoid same user login into Website and Mobile App (Using the Web Service) at the same time. Basically user can log in only to a one service at a time (either web or app). Also, user should be able to log in to Mobile App as soon as web browser is closed or logged out.

If user tries to log in while already logged into the other service, code should have a way to find it for notification and restriction purposes.

I think AppFabrc address the requirement but needs Windows Server 2008 R2 which we don't have at the moment.

Hope you have better ideas??

Please note this is not the same question as this.

Community
  • 1
  • 1
Kaf
  • 33,101
  • 7
  • 58
  • 78
  • 2
    `user should be able to login to Mobile App as soon as Website is closed (not just properly loggin out from Website)` what do you mean by this? What does `Website is closed` mean? – JohnDoDo Mar 20 '12 at 15:16
  • Ah, I mean as soon as `browser` is closed. ie; session should be cleared not just at the time of logout. Will edit the question. thanks – Kaf Mar 20 '12 at 15:21
  • Forgive my ignorance - I'm not familiar with the technology - but how can AppFabric help in this situation? – JohnDoDo Mar 20 '12 at 16:27
  • I am not an expert of AppFabric either. But I think it can be used as [session state provider](http://msdn.microsoft.com/en-us/library/ee790859.aspx) for both site and service. – Kaf Mar 20 '12 at 16:54
  • 1
    Is this a WCF service, or an ASMX service? Do you have a web site "project", or a web application project? Which version of .NET and Visual Studio? Finally, is your current web site authentication depending on `Session`? – John Saunders Mar 20 '12 at 19:28
  • @JohnSaunders `ASMX Web Service`, `Website project`, `.Net 3.5`, `VS 2008 Framework`, `Session dependent`, `Webform authentication` - Thanks – Kaf Mar 20 '12 at 19:40

2 Answers2

0

FYI... you don't get any notification when the browser closes. You could go based on the last activity time (basically keep track of user activity - page clicks, etc). I also don't see how appFabric is going to help. You still have the same problem.

dvallejo
  • 1,033
  • 11
  • 25
  • FYI, nothing in this "answer" has anything to do with solving OP's issues. Please keep personal side comments to "comment section" or to self. – Dave Alperovich Oct 18 '13 at 08:33
0

As others have mentioned, there is no easy way to know when somebody has closed the browser. You could use javascript to detect when somebody leaves your web app but there are some issues (see the following question and answers for more information: How to capture the browser window close event?)

If you're open to other workflows, you could try this:

  • When the user logins to the mobile app, have the mobile app log him out from the web site.
  • When the user logins to the web site, have the web site log him out from the mobile app.

That way your users would login and start working right away instead of them having to log in, see an error, logout from the other app, log in again.

Community
  • 1
  • 1
Jorge Vargas
  • 1,031
  • 11
  • 25
  • Thanks for your post. Even if the workflow is changed, how can I logoff the user from website if logged in from mobile app? Back to square 1. Isn't it? – Kaf Mar 20 '12 at 21:42