Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello everyone. I have a problem in writing a function of web service.

In the web service, there is a function which available to one user only at one time. Therefore, I write some code in global.ascx like:

 

Application.Add(("SchHHGInUse"& Dt.Rows(i).Item("hhgId")),-1)

whenever the first user use the function, it change the value in application to his userId. Therefore any other user can see the change and do not allowed to use the function.

 

When the first user click "QUIT" button or "LOGOUT", the value in application will change back to -1. Therefore the next users can use the function now.

 

However, since most users seems not likely to obey the rule. Which just click X button at the windows right top end. Will cause the function be locked from any other users....

 

My problem is, since the user information is stored in his own session. At the time the session timeout, the server cannot unlock the value of Application too! (because server do not know whether the current user of function is timeouted or not)

 

I am quite a newbie to this type of web service. Please give me any idea you have. It will be helpful! Thank you!

  • Administrators
Posted

Is there a reason this function can only be accessed by one user at a time - this kind of behaviour can make your life a lot more difficult.

If you are restricting your web service to one user till they log out (the impression I got from your post) then you are going to have serious scalability issues with this scenario.

It may be better to post what the application / web service are doing and see if anyone has a better suggestion for the application architecture.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Also, HTTP is a stateless protocol.

What happens if your user never logs off?

 

is this a licensing requirement or a threading issue?

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted

I agree with Derek. You can't do it..... that way.

 

I have one solution. Not like you wanted it but one solution anyway.

 

Make this "function" usable only by 1 user­. 1 login permitted at a time and logoff the user after 20min or 30 or any.... (ever if it's still alive). I'm sure that THIS is possible.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

i see...

 

First of all, thank you for your reply. Let me tell more details ... In fact the function I mentioned is the scheduling management function. All the manager of different teams can only access their teams' schedule. Some of manager can access to more than 1 team and some of teams have more than 1 manager (from 1-5). I don't want the managers access and update the schedule at the same time because they may not get the latest version if someone is editing.

 

I want to try Arch4ngel's idea but I have no idea how to count the access time of users...

  • Administrators
Posted

There is no easy reliable way to do this - if you want to only allow one person in at a time and then only time them out after 20 or 30 minutes you are looking at restricting your application to 2 or 3 users per hour - pretty unacceptable I would say.

 

If the system can be updated by multiple people then there needs to be some other mechanism in place to either prevent conflicting updates or to make sure changes are visible - this may be as simple as after a change is made requery the data and redisplay it, it is then up to the manager to check nothing was amended that conflicts with his update.

If you really require only one update / user then web services are not the technology to choose and you may be better of going with a windows forms / transaction based application instead.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...