Treat Race Condition Of Session In Web Application?

Apr 3, 2010

I was in a ASP.NET application has heavy traffic of AJAX requests.Once a user login our web application, a session is created to store information of this user's state. Currently, our solution to keep session data consistent is quite simple and brutal: each request needs to acquire a exclusive lock before being processed.

This works fine for tradition web application. But, when the web application turns to support AJAX, it turns to not efficient. It is quite possible that multiple AJAX requests are sent to server at the same time without reloading the web page. If all AJAX requests are serialized by the exclusive lock, the response is not so quick. Anyway, many AJAX requests that doesn't access same session variables are blocked as well.If we don't have a exclusive lock for each requests, then we need to treat all race condition carefully to avoid dead lock. I'm afraid that would make the code complex and buggy.

So, is there any best practice to keep session data consistent and keep code simple and clean?

View 2 Replies


Similar Messages:

.Net GridView EditIndex Race Condition?

Oct 12, 2010

This is a bit of a hypothetical question that has sent me off down the garden path... Say I have a gridview that I'd like to edit... given a method that binds the data..

private void BindGridFirst() {
var data = new List<string>() {
"A","B","C","D","E","F"[code]...

Now presume that I'm looking at this page, and another user has come along and made some changes to the underlying data, and I now go and click the edit button to edit D...

The edit method is pretty straight forward:

protected void RowEdit(object sender, GridViewEditEventArgs e) {
gridView.EditIndex = e.NewEditIndex;
BindGridSecond(); [code]....

It's exactly the same, but the data is now changed. Once the UI updates, the user is now in edit mode against row C.Not what the user expected or wanted. How should this scenario be handled to avoid such an issue?

View 2 Replies

Windsor And .net MVC Singleton Race Conditions?

Dec 14, 2010

Quick question regarding the use of Singleton lifestyle in Windsor, and Asp.Net MVC. If the following class is registered as a singleton am I correct in thinking that I will have a race condition?

public class UserMapper : IMap
{
public void Map(MyDto dto, MyDomain domain)[code]...

View 1 Replies

.NET 2.0 And 4.0 Seem To Treat The Root Url Differently In Forms Authentication?

Feb 22, 2011

If have the following web.config:

<configuration>
<system.web>
<authentication mode="Forms">
<forms name="MembershipCookie"
loginUrl="Login.aspx"
protection="All"
[code]...

View 1 Replies

Security :: Treat App Folders's With Single Login.aspx

Nov 5, 2010

I'm developing ERP project with 4 modules or maybe will be more within (1 module I mean 1 project in VWD)

And now 1 of it project near complete, and now I want to move to next module

But in my scenario, I want my single login.aspx to access all of modules

Let say like this

root/login.aspx
root/app01/*.aspx
root/app02/*.aspx
root/app03/*.aspx
root/app04/*.aspx

The question is, is that correct of scenario (4 project for 4 module)? How was the correct best practice if there is? What if I create all of the module in 1 project in VWD? future maintenance handy and performance wise (and security of course).. and maybe for easier in development also :)

View 3 Replies

Session / Renew An Application Session By Just shaking The Mouse?

Apr 9, 2010

Is it possible to renew an application session by just shaking the mouse?

View 8 Replies

Make Visual Studio Treat .htm Files Like .aspx Files?

Apr 15, 2010

I've inherited a bunch of code that has server script inside of .htm files.

On IIS, a handler mapping pumps.Htm pages though the asp.net engine.

Unfortunately, visual studio doesn't notice that they should be treated as code.

Is there any way to make VS treat .Htm files as code/aspx files?

View 3 Replies

State Management :: The Service Seems Not Working Correctly - Application Pools Recycles The Application Loose The Session?

Jul 7, 2010

we are experiencing big difficulties in the configuration of ASP.Net state service and II7. The service seems not working correctly because when the application pools recycles the applicatio loose the session.If we try the same configuration in IIS6 it works correcly.What is the correct way to configure the aspnet session state service in iis7?

View 2 Replies

State Management :: Use Session Variable From Application To Another Application?

Apr 27, 2010

I Want To Use A Session Variable From One Application to Another Application. Is That Possible in ASP.NET 3.5 Or Greater To Use Session Variables As i Required. My Both Applications Host In Same IIS Server.

Me To Sort Out This Prob. ASAP

View 1 Replies

Architecture :: Best Way To Kill Session From One Application To Another Application In C#?

Dec 8, 2010

Which is the best way to kill session from one application to another application in C#

View 5 Replies

Application Variable Instead Of Session?

Dec 28, 2010

i am redirecting from a 3rd party site to my application where i am getting the responses of credit card no,cvv no and exp date into my application.but the session data that had come from the previous page is being lost.i have tried using application instead of session and its working fine will there be any disadvantage of using application over session

View 9 Replies

Destroy Session In An Application?

May 28, 2010

I have several pages in my application. I have used a session variable called "Session["Variable"]" that is set in page1 and page2. That means The scope should be in page1 and page2. If you go out any of these page will clear the above session variable. Is there any solution to clear the particular session varible in the application level. i.e i don't want to write the code for each and every pages...

View 4 Replies

Close Session Of Same Application In All Tabs

Mar 25, 2011

In my web application, I use an exit button which runs session.abandon to close the session and then close the browser. It does not work with multi-tabs in IE. If I open my application in two tabs, I click on the exit button in one tab which abandons the session and close the tab. But the application in another tab can still work. Is there any way to close the session for this application in all the tabs?

View 3 Replies

Sharing Session Between Webservice And Application

Apr 23, 2010

I have an asp.net application and webservices (asmx) that reside in the same application but not in the same folder of the aspx files. I aslo have a winform application that uses the webservices. I have marked the webservice methods with [WebMethod(EnableSession = true)] but I am not able to share the same session values that are on the application in the webservices. The winform application has access to the sessionID from the application and I am using the following code

Uri uri = new Uri(ServerServiceUrl);
_cookieContainer = new CookieContainer();
_cookieContainer.Add(new Cookie("ASP.NET_SessionId", SessionID, "/", uri.Host));

My question is: Is there something that I am missing or doing wrong that I cannot access the application sessioin from the webservices?

View 2 Replies

Concatenate Two Session Values In Web Application?

May 10, 2010

concatnate two session values. I need to concatnate

Session["probmgremail"].ToString();and Session["TextBox2"].ToString();

The output should be a combination of two values seperated by a semicolon(;).

The session values are email address.

View 2 Replies

Application Versus Session / Cache

Feb 23, 2011

What is an appropriate use case for all of the above? It seems session and cache are quite similar, and I can't think of much use for application.

View 3 Replies

MVC :: Session Is Null With A Hybrid Application?

Apr 2, 2010

I apologize if this question has been asked prior, but I hunted around for about 3 hours today looking for some information. I have taken our existing application and converted it to use both Web Forms and MVC. This application uses multiple modulessuch as Products, Orders, Administration, etc... Each one of those is a web application and a hybrid that is copied into the main application at build time. We are using the Composite Web Application Block to handle our modules and IoC. I have created a Controller Factory that inherits the DefaultControllerFactory and overrides the GetControllerInstance method. However, I commented this out and it still gives the same problem. That problem being that when the controller is in an action, the Session is null. From what I understand, the Handler implements IRequiresSessionState, so the session should not be null. I have tried it out in a smaller, non-hybrid application and the Session is not null. Therefore, it is something that I am missing in the application that I have converted. If anyone has any information on what I might be doing wrong,

View 3 Replies

C# - Use Session Variables In Windows Application Using VC#?

Feb 24, 2010

im new to asp.net. . . im doing my final year project.How to use session variables in application using VC# and I also need to check with data base?

View 2 Replies

Difference Between Session And Application Objects?

Jan 19, 2010

I know that Session is for a single user , and application is for multi user purpose.The Data in the application object is shared. Right? Then how can access the application data from an another client.

if My concept is wrong then what's right?

View 1 Replies

How To Increase Session Timeout In Web Application

May 8, 2013

I need the increase the session timings in online publish server using web.config , which is the maximum limi of  session timings

View 1 Replies

Web Forms :: After Login Get The Application Role In A Session?

May 11, 2010

In my application. I have a master page where i have a menu control. After login i get the application role in a session. Now based on the application role I need to remove some of the items which are not required for general users.How can we check the menu and remove in master page. I tried below code but its not working.

[Code]....

View 7 Replies

How To Keep Session Alive Between Two Calls To A Web Service In A C# Application

Oct 5, 2010

This is quite straight forward. I'm calling a web-service (.asmx, with session enabled) from a c# application. I want each call to be with the same session key as the previous one (as opposed to creating a new session key each time).

Here's my (nothing-out-of-the-ordinary) code:

[Code].....

View 3 Replies

Security :: Prevent Session Identifier In Application?

Mar 4, 2010

Hacker's attack the session ID in asp.net application. How can we protect the session identifier from hackers.

View 1 Replies

Configuration :: Session Timeout On Job Application Page?

Jan 12, 2011

We have a asp.net application where users will apply for jobs online. When users fill out the form the page isn't timing out the session. If a user goes back to the main page the last user's information is still available.

I have setup many websites and have never had to make any changes on IIS, under the configuration within the website. The default is 20 minutes we can change it to 8 or 10, but I think this issue should be taken care of in the code. The setting will affect the entire site instead of the pages that need to timeout.

What is the best way to do this within the code?

View 2 Replies

Session - Why Does Application Recycle When Delete A Folder

Sep 27, 2010

I have a Silverlight application using a WCF service hosted in IIS. I make use of some aspects of ASP.NET. I have the following folder structure for my application:

inetput
wwwroot
myapp
reports
{user-guid-folders}
report1.pdf
report2.pdf
App_Data (folder)
bin (folder)
Client_Bin (folder)
(various .aspx files, plus web.config, etc.)

The application dynamically generates reports and puts them in a folder with a GUID for the name which is unique to the user. This all works fine. However, when the user logs out I was cleaning up and deleting the PDF files in their folder, then deleting their GUID folder.

Deleting the files works fine, but if I delete the folder, the application recycles (which then removes all other users' sessions - I get a Session_OnEnd event for every user's session, and an Application_OnEnd event. The next user request causes the whole application to restart. So, while I can fix this by not deleting the GUID folder (which my application itself created), what is the reason for this? Is there any way I can prevent this from happening?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved