.net - Locking Individual Elements In A Static Collection?

Feb 28, 2011

I have a static collection of objects that will be frequently updated from multiple threads.Is it possible to lock individual objects in a collection instead of locking the entire collection so that only threads trying to access the same object in the collection would get blocked instead of every thread?If there is a better way to update objects in a collection from multiple threads, I'm all ears.

View 3 Replies


Similar Messages:

Using Javascript (DOM) - User To Drag Individual List Elements From One Box To Another

Jul 6, 2010

I have an asp.net page with several list boxes. I would like to include some javascript on the page that allows a user to drag individual list elements from one box to another. On a normal web page, the script to do this is reasonably simple, however, with the element IDs generated by ASP.NET, I don't know what identifiers to have my script look up?

View 3 Replies

Does Record Locking (Pessimistic And Optimistic Locking) Is Applicable

Oct 8, 2010

Does record locking (Pessimistic and Optimistic Locking) is applicable in ASP.NET application? If so, What is the pros and cons on doing this?

View 3 Replies

Load Dynamic List Of Elements AFTER FINISHED Loading Of Several Form Elements?

Mar 1, 2010

I have...a dynamic populated select box several input boxes a submit button form fields are loaded initially using cookies several dynamic populated divs

I want... start loading the content of my DIVs after all FORM elements have been loaded completely (= filled with data, select boxes are populated)

Sample code:

[code]....

View 1 Replies

Forms Data Controls :: Bind A Collection Within A Collection To A Gridview?

Jul 26, 2010

I have a list of objects that I want to bind to a gridview. Creating that list and binding it works fine for most of the public properties in that list.

There are some objects contained in each of those objects... for instance there is an Address object.

object.Address.Line1;

object.Address.Line2;

When I bind this to my gridview, I have no issues with stuff like object.DateRegistered, but how can I access things like object.Address.WhatEverProperty? I always get this error:

"A field or property with the name 'xxx.xxxx' was not found on the selected data source."

View 7 Replies

C# - Is It Safe To Access .net Session Variables Through Static Properties Of A Static Object

May 10, 2010

Is it safe to access asp.net session variables through static properties of a static object?Here is what I mean:

public static class SessionHelper
{
public static int Age
{
get
{
[code]...

Is it possible that userA could access userB's session data this way?

View 2 Replies

Web Forms :: How To Use Collection Class For Collection Of Data

Mar 31, 2010

I want to know that how i use the collection class for storing some data and save it letter in the data base.

View 4 Replies

C# - How To Lock A Private Static Field Of A Class In One Static Method

Mar 26, 2011

I have a private static field in my Controller class in an MVC web application.

I have a static method in that controller that assigns some value to that static field, I want to apply lock on that static field until some other instance method in the controller uses the value stored in the static field and then releases it.

DETAILS:

I have a controller named BaseController having a static ClientId field as follows and two methods as follows:-

public static string ClientId = "";
static void OnClientConnected(string clientId, ref Dictionary<string, object> list)
{
list.Add("a", "b");
// I want the ClientId to be locked here, so that it can not be accessed by other requests coming to the server and wait for ClientId to be released:-
BaseController.clientId = clientId;
}
public ActionResult Handler()
{
if (something)
{
// use the static ClientId here
}
// Release the ClientId here, so it can now be used by other web requests coming to the server.
return View();
}

View 1 Replies

AJAX :: Calling Non-static Methods From A Static Method?

Jun 30, 2010

I did some research after posting. All I found was simple examples for no-layer architectures, like connecting to a database from your aspx page, so, in a corporate environment, it is unnaceptable.

I need to call a server-side method (using ASP.NET Ajax) in a 3-layer architecture.

For example, my Default.aspx contains a method LoadProducts().

[Code]....

[Code]....

This cannot change. There is no way to convert Business and Data layers to static.

How can I call the LoadProducts() method using ASP.NET Ajax?

View 2 Replies

Add Controls To A Collection And Update From Collection?

Mar 25, 2011

I have an ASP.NET app with lots of textboxes all over the page that need updating at various points through program execution.

These textboxes actually belong to a certain class, so for easy updating I thought I could create a Dictionary(Of string, object) and add the control.ID and the control to it and then for updating do something like this:

(in case of updating textbox.text):

[code]....

However the text property of the textbox does not actually get updated. I'm mainly trying to avoid having to manually do textbox.text = somestring for each one of my textboxes every time I have to update them.

View 3 Replies

Locking Down Application To Everyone?

Nov 5, 2010

I use the app_offline.htm file to bring my site down when I have to roll a new revision. However, even after I launch I'd like to be able to play around and test my site before anyone else has access. Since almost all of my pages are available without logging in, I need to way to lock down my application to everyone but myself and obviously the app_offline.htm file won't for for this.

I have a BasePage class and I'm thinking the only way to do this would be to put code in that class's Page_Init method and I could check for my specific IP address and kick everyone whose IP doesn't match to the app_offline.htm file. However, I'm wondering if this would be the best method since my IP will change.

View 3 Replies

ADO.NET :: EF - Record Locking?

Mar 8, 2011

I'm about to begin a new web project using asp.net 4.0 (EF 2.0). I have a question on row locking...customer is concerned that if employee 1 has a record in edit mode, they want to lock the row and make it uneditable for other users, until employee 1 has saved their changes. A step further is, if employee #2 attempts to edit the locked record, a notification would appear, notifying employee #2 that "Employee #1 John Doe" has the record locked and to contact them.

View 4 Replies

C# - Locking An Application Variable?

Dec 10, 2010

I'm using a 3rd party web service in my ASP.NET application. Calls to the 3rd party web service have to be synchronized, but ASP.NET is obviously multi-threaded and multiple page requests could be made that result in simultaneous calls to the 3rd party web service. Calls to the web service are encapsulated in a custom object. My thought is to store the object in an application variable and use the C# lock keyword to force synchronized use of it.

I'm nervous, because I'm new to multi threaded concepts and I've read that you shouldn't lock a public object (which my application variable effectively is). I've also read that if the locked block of code fails (which it could if the web service fails), then it could destabilize the app domain and bring down the application.I should mention that the 3rd party web service is rarely used in my website and it's going to be rare that 2 requests to it are made at the same time.Here's a rough code sample of how I'd make calls to the web service:

ThirdPartWebService objWebService = Application["ThirdPartWebService"] As ThirdPartWebService;
lock (objWebService)
{
objWebService.CallThatNeedsToBeSynchronized();
}

View 4 Replies

Web Forms :: Locking Id Into Databse?

Sep 14, 2010

i have create a form..and i generate ID using dropdown list for user for registration before they save the page..the ID will appear when click "signUp" button.("ID" not saved yet into database)

i want the "ID" lock into databse when click "signUp" button..

View 3 Replies

Iis7 - IIS Is Locking PInvoke Dll?

Nov 11, 2010

I have an ASP.NET MVC website that uses an internal dll for some PInvoke stuff. The dll is located in the /bin folder next to the other assemblies. This works well, but if I want to replace the content of the /bin folder with the newest set of files by copying onto the existing files (this is on a test server) the PInvoke dll is locked/used by the w3wp.exe worker process and cannot be replaced except after you recycle the apppool or restart IIS.

Is this standard behavior or can I somehow instruct the ASP.NET runtime to take a shadow copy of the PInvoke dll similar to the regular assemblies?

View 1 Replies

Public Static Variable Declared In Public Static Class MyGlobals In A 'Code File' Template?

Jan 27, 2011

I have a question about C Sharp ASP.NET:Is there a difference (in code speed, resources) between:public static variable declared in public static class MyGlobals in a 'Code File' template;and the variable declared in a normal 'Class File' template;I use this variable in 2 different Class Files and also in _Default Page codebehind cs file.In fact in my case I need about 20 global variables of type List<string>.

View 9 Replies

DataSource Controls :: Locking The Database?

Jan 12, 2010

I have multiple database running in my SQL Sever , in that I need to lock only one database is there is any inbuilt method in SQL Server 2008

View 1 Replies

Databases :: Locking Down The Proc Table?

Feb 27, 2010

I'm working on locking down some MySQL user accounts. At the moment I typically grant my user accounts execute privileges over the required stored procedures within a schema.Now I'm looking at the proc table in the mysql schema. The common wisdom that's quoted many times on various websites says "Stored procedures require the presence of the proc table in the mysql schema".By granting select access over the proc table stored procedures will work. But if I removed the above select privilege and grant the user execute privilege over the entire mysql schema the procedure will also work.

Does anyone have any ideas about the security issues by choosing one of the above over another?I would prefer to lock the proc table down all together so the user cannot see it cannot select from it.

View 1 Replies

.NET Web App Deadlocking - It's Caused By SQL Server Locking

Mar 6, 2010

Our client's web app restarts suddenly at random intervals. For each restart, we've found an entry like this in the Windows Event Log:

Event Type: Warning
Event Source: W3SVC-WP
Event Category: None
Event ID: 2262
Date: 2/21/2010
Time: 1:33:52 PM
[code]...

View 2 Replies

Active Directory Account Locking Out On First Try?

Jul 6, 2010

I have a website which requires users to enter their corporate network username and password. It then looks for that account in Active Directory and gets a list of any email addresses associated with that account.

The problem I am having is that ONE incorrect password is locking out an account. Our domain policy is that an account will lock out after three incorrect entries, so I am assuming that I am doing something wrong in my code. I am not very knowledgeable about Active Directory or .NET DirectoryServices in general, which may be apparent from my code. Here it is:

public ArrayList AuthenticateActiveDirectory(string Domain, string UserName, string Password)
{
// An error occurs if the username/password combo does not exist.
// That is how we know it is not a valid entry.
try

[Code].....

View 1 Replies

VS 2013 / PDF Protecting / Stamping And Locking?

Jun 9, 2015

I have an ASPNET Application (C#) that runs on my company intranet. This application allows the users to attach PDF files against records.

I am trying to get that PDF uploaded in such a way that whenever the user initially uploads (the uploaded PDF will always be unlocked PDF), the user name would be stamped on the PDF file and the files is locked by my application so that the user cannot change the PDF again, even when having a PDF Writer. Whenever required the application should allow the user to unlock the PDF and then allow the user to edit the PDF.

View 4 Replies

Working With Static Variables / Store The User Specific Information In Static Variables?

Mar 5, 2011

whats the exact use of static variables in overall programming in .net and for asp.net...

Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..

whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.

View 3 Replies

SQL Server :: SqlTransaction.BeginTransaction IsolationLevel Locking?

Oct 2, 2010

i have a web application who uses a stored proc in our SQL Database and process the data with SqlTransaction.BeginTransaction. but we don't place any isolation level.

The stored proc have multiple processing like insert, update and large queries from multiple tables. we decided to place the SqlTransaction class in our code to access the commit and rollback method incase the stored proc has an error.

later when the user is using our website, they experience locking, by the way the average number of users are around 600 a day.

is it possible to eliminate the chance of locking when using the SqlTransaction class when we use an isolation level like "Snapshot".

if not, what level should we use.

[Code]....

View 1 Replies

Visual Studio :: 2010 Locking Files?

Aug 13, 2010

VS2010 keeps locking my .aspx files so I can't edit them. I have to stop the project, close and reopen the file. Is there a setting causing this (it doesn't happen on my home machine)?

View 1 Replies

Access :: Locking Mechanisim To Manage Transactions?

Dec 29, 2010

I am building an aspx page using c# and Visual Studio 2008. can anyone help to answer this question,Q1. When a page has add/edi/delete features by calling stored procedure or sql inline code (within the aspx page) It may cause issues in this senario:two users accessing the same page, lets say they both at the same time are editing the same record. a third user is only viewing that same record. how can I control such senario who get to make the change first.Q2. if the thrid user accessed the record after the first user change the records, but before the second user change the record. is he going to see the origional record or the updated record done by the second user.Q3. if the third user opened the record to view it before the first user make any changes, so he is opening a grid view , lets say the first user make a change. The third user will still see the old record...right, so he is not viewing updated record.how would he know that the record he is viewing is not current?If anyone can explain the senario and also would appreciate if you have any documentation or URL reference to searh .

View 1 Replies







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