.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Static/Shared Confusion

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
 
Hi All, Thanks for looking into this, Iam confused.:(  My understanding: Actually to my understanding static/shared objects will be saved in a memory that is shared by all instances of the asp.net application,so if we set a value to shared object from inst1 & i should be able to access it via instance2(may be in same computer or anywhere) Actually: In my vb.net application,previously they defined shared dataset to hold some information specific to the user,still now i cant reproduce the error that same value shared across all application instances. Please help me to solve or clarify this. This article even confused me a lot http://www.c-sharpcorner.com/UploadFile/suthish_nair/3020/


View Complete Post


More Related Resource Links

Static Class for Beginners

  
In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

abstract away the source of the connection string using a class with a static property.

  
ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Encapsulation
Let's abstract away the source of the connection string using a class with a static property.

Public Shared function doubt????

  
Hi
I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

I am confused here. Is it the right way to go?

Please advice. Thanks in advance.

Pankaj

NUnit and public static readonly

  

I have an app that I am testing with NUNit.  The project im testing has several helper classes that are created as public static readonly.  When I run the NUnit tests, they all fail with the same error


Systems.Code.Test.TransactionTest.CreateDataContext_ConnectionString_ReturnsDataContextObject:
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
Systems.Code.Test.TransactionTest.CreateDataContext_ConnectionString_ReturnsDataContextObject:
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.

I kept getting this error despite stripping out all

Toolbox: Static Analysis Database Tools, Managing Remote Computers, And More

  

If you want to apply static analysis to your databases, connect to remote computers, find out more about the Entity Framework, or just check into some cool podcasts for your daily commute, then you'll want to read more about these latest tools and resources.

Scott Mitchell

MSDN Magazine July 2009


Toolbox: Static Analysis Tools For .NET, Matt Berseth's Blog

  

This month we take a look at FxCop and other tools that enforce your design rules, along with jQuery.

Scott Mitchell

MSDN Magazine December 2008


Editor's Note: Code Name Confusion

  

We'd like to have a word about product code names this month.

MSDN Magazine February 2006


Basic Instincts: Static Event Binding Using WithEvents

  

This month's Basic Instincts column builds upon my last three columns in which I introduced and explained the fundamental concepts and syntax associated with delegates and events. Last month I showed you how to design and write a simple class that defines and raises events.

Ted Pattison

MSDN Magazine March 2003


Rotor: Shared Source CLI Provides Source Code for a FreeBSD Implementation of .NET

  

With over 9,000 files, and including some 1300 public classes to pore through, the Shared Source CLI can teach you quite a bit about the internal workings of the CLR. But the sheer amount of source code included can make just starting your exploration a monumental task. This article discusses some of the things you can learn from the source code facsimile of the CLR, like how JIT compilation works. It will also help you understand how to control execution along with debugging and loading classes. A walk through the steps involved in setting up the runtime will let you become familiar with the process.

Jason Whittington

MSDN Magazine July 2002


Where to get Microsoft.SharePoint.WebPartPages.Storage.Shared

  

What reference should I add to use this:

Microsoft.SharePoint.WebPartPages.Storage.Shared

because apparently it cant find it.


IIS - sharepoint/default website port number confusion

  

Hi,

I have MOSS 2007 installed with IIS V7.

My default web site port is 80. When I created a new web application for my main sharepoint portal I also set it to 80. So obviously now the default web site port shows as stopped in IIS and it won't start.

What are the best practices. Should I change the port number for my portal to something else? I mean is it even a good idea to have sharepoint on port 80? If so, how do I go about changing the port number for my portal site?

any help appreciated.


Comparing Enum values in a collection - BC42025: Access of shared member, constant member, enum mem

  

I am upgrading from asp1.1 to 2.0

I use collection classes to sort data (e.g in datagrids etc)

Public

Enum newsFields
      title
End Enum

Public Overloads Sub Sort(ByVal sortField As newsFields, ByVal isAscending As Boolean)
   
Select Case sortField
         
Case newsFields.title
                     
MyBase

is there any impact of using static methods in Business Access layer in 3 tier applciation

  

is there any impact of using static methods in Business Access layer in 3 tier applciation,


Please suggest me what are the best practices and standards


SharePoint and "Help Desk" template confusion

  
Okay; so I've read the three posts I found on this forum about the SharePoint Services "Help Desk" administrative template. I've scoured the internet for nuggets of wisdom; all-in-all, I've come to the conclusion that there is hardly ANY documentation for this template! :) So please excuse me if this question is considerd "noobish-ish" by some--I just a looking for a fresh set of brain cells to bounce my question off of. The template, itself, seems pretty bare bones and to the point, as far as ticketing issues. But how in the site settings do I specify a Service Request, when a domain user clicks on the "Create a Service Request " link, to go to a specific help desk email account on our Active Directory network? I see "Create a Service Request," "Service request List," "Service Request Task List;" it's getting a little confusing, as I don't use the "portal" end of SP, as much as I administrate our server. Where should I start, one and all?? ANY help will be greatly appreciated; thank you!

Static property. how does this work?

  
I want to understand how this works? public class UtilityDate {         public UtilityDate ()         {         }           public static UtilityDate Instance         {             get             {                 return new UtilityDateFacade();             }         } public DateTime GetDate(long userId) { //SomeImplementation //which gets datetime from database }  }     What heppens when i say   UtilityDate     .Instance.GetDate(1); Thanks 
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend