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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Static Object in Web Site

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net

I am working on a small web site that does some recursive calculations on a relatively small set of data in a database. To increase performance and decrease load on the DB server, I would like to load the data into a DataSet that is made up of multiple DataTables. My problem is in knowing how to create this DataSet once and only once. I need to be able to access it from multiple web pages within the website and I would like to NOT have the DataSet recreated every time a new user accesses the web application, if possible. I'm working with C#, VS2010 and MySQL if it matters.

Anyone have suggestions on how I might approach this problem?

I wasn't quite sure which forum to place this in since it really involves web sites, C# and ADO. If it needs to go somewhere else, please let me know.



View Complete Post

More Related Resource Links

Build an Easy Maintenance Intranet Site: Using Office Docs, File System Object, and OLE Structured S


If you've ever needed to build an easy-to-maintain intranet site, here's a solution based on Microsoft Office documents. Many sites require constant updating of their HTML, but the use of Word documents can simplify the process. This article details the construction of a human resources site that exploits the File System Object (FSO), OLE Structured Storage, and ActiveX capabilities of Word documents. This allows the HR staff to copy their revised or newly created Word files to the site, dynamically generate a list of links to their files, and free IS from the constant recoding of HR updates into new HTML pages.

Josef Finsel

MSDN Magazine March 2000

SharePoint 2010 Publishing Site : Operation is not valid due to the current state of the object.

  I think as usual, the new version of SharePoint 2010 has a lot of problems. the below messege appear in a publushing site (FBA) enabled and when I try to access the pages list or even approve a page of accessing the SiteCollectionImages list and ......... etc every link produce the below error. I'm very frustrated with 2010.  Server Error in '/' Application. <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object.] Microsoft.SharePoint.Library.SPR

Object Cache set with Portal Super User accounts. Access denied to site.

I have the same issue on multiple farms. In this example i'll outline this problem for a three tier farm. SharePoint web server SharePoint Application server (hosts central admin) Sql server After installation and configuration i have created two web applications (claims based auth with NTLM). https://portal.contoso.com https://mysite.contoso.com The client connects on the URLs to the web server (1st tier). All is working correctly and they can access the portal and their mysite. The log file keeps reporting that i need to configure the user accounts for the Object Chache. So, i looked up the required steps and executed these conform mcrosoft guidelines (http://technet.microsoft.com/en-us/library/ff758656.aspx) All the steps run seccesfully. But when i connect to the URL i now get an access denied (even with the administrator who is site collection administrator) In the log file i get the following to lines when i connect to the site. Unknown SPRequest error occurred. More information: 0x80070002 Unknown SPRequest error occurred. More information: 0x80070005 I have exact the same issue on two other farms. Marc

How to all the Subsites and Site Collections under a top level site collection using client object m

Hello Everyone, I need to know how to get all the subsites and the site collections under a top level site collection using client object model in SilverLight. When I use WebCollection webcoll= ctx.Web.Webs I'm getting the getting subites but i'm not getting the RootWeb and Othe SiteCollections created under the Top Level site collelction.

Site Manager Error object reference error line 145 SiteManager.aspx SmtPostBackHandler1.UniqueID

Hi I am getting error bellow irrespective of if its IE or firefox Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 143: Line 144: Line 145: <a onclick='javascript:__doPostBack("", "Refresh=<%= TreeView1.SelectedNode.Value %>")' style="cursor:pointer"> Line 146: <SharePoint:EncodedLiteral runat="server" text="<%$Resources:cms, SmtRefreshLink%>" EncodeMethod='HtmlEncode'/> Line 147: Source File: c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SiteManager.aspx Line: 145 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.get_WebServerRelativeUrl() +148 Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.get_CachedList() +149 Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.get_AutomationId() +178 Microsoft.SharePoint.Publishing.Internal.WebContro

New Linq to Sql object crashing entire site


I have a site with many application roots below the main root

  • mainSite (application root)
    • admin
    • subfolder1
    • subfolder2 (application root)

I have a database connection saved in my database explorer that when test, does work.  I created a Linq to SQL in the subfolder2 application and the connection string is saved in /subfolder2/web.config.  This works absolutely perfectly.

Today I attempted to go in and create the admin page (as part of the primary root, but in a folder) for this newest subfolder application - like I have done a million times.  First I create the empty Linq to Sql object, everything continues to work.  But as soon as I add the table for the new application to the dbml, everything dies.  First I get the Custom Error screen telling me to turn off custom errors, and when I do,  I get the blank 500 server error on EVERY page, including html and css files, and not just in the root application, but in the nested applications as well.

First, what on Earth could possibly be so bad that IIS stops serving html files?

Second, why would the dbml editor allow me to add the table if there is something wrong with it?

Third, why is this functioning in other applications?  Is it some sort of duplicate nested information issue for either t

Add a field to site columns using Client Object Model



I am having an issue when trying to add a field to the web.AvailableFields.  I am using web.AvailableFields.AddFieldAsXml(...)  but it seem that you need to associate the field with a list.  Is it not possible to add a field to the site collection columns using the client object model?

What I am doing is creating a content type and then adding fields to this content type, if the fields dont exist I what to create them but an having a problem doing so.



Create SPUser object using user credentials on claims based site.



I would like to create SPSite object and pass user token as an argument to make sure all operations are executed with SharePoint security trimming. Inside SPSite I am reading some file content using File.OpenBinaryStream() method.

I am not sure if there is a way to create SPUser using user credentials. I am able to get SPUser by getting it from SPWeb.AllUsers collection using user login name. However it doesn't work for claims based sites as login name for these users looks like i:0#.w|domain\username. 

Am I allowed to user code like this:

SPUser user = web.AllUsers["i:0#.w|domain\username"];

to get SPUser object? I know that 'w' from 'i:0#.w' string means that it is Windows user. What do other symbols mean? Is there any method which can generate login name from user credentials so I may use it to get SPUser from AllUsers collection?

Possibly there are some other ways to execute code for SPSite under some SharePoint user privileges?

P.S. All my code is running out of SharePoint context. I have tried to user windows impersonation but got Access Denied error.

Thanks beforehand for any help,


Start site workflow using silverlight client object model.



I created a sequensial site workflow using VS2010. Its working fine. I want to start it manually using silverlight client object model.

Can any one help me how it can be done?

SharePoint 2010 site using FQDN and Silverlight Client object model issues


I am working a FQDN installation of SP2010 site and I am having touble connecting to it from Silverlight, when my Silverlight app is running outside that SP2010.
Just to include the note, that if I use the CLR client object model, from a Console Application, I am able to connect to the FQDN SP 2010 site, and get all data I need. Using the CLR and monitoring with fiddler there are two consequent requests made: first GET to http://my_sp2010_site_fqdn/_vti_bin/sites.asmx, then POST to http://my_sp2010_site_fqdn/_vti_bin/client.svc/ProcessQuery and Everything works fine.
However when it comes to the Silverlight Client I have troubles.
If I put my silverlight application in a web part inside my site, it works. If I put it on a regular site, outside SP - it does not work and following behavior is observed:

There is initial request sent to
but there is no consequent request to http://my_sp2010_site_fqdn/_vti_bin/client.svc
That second request does not even show up in fiddler.

private ListItemCollection _projects;


How to Get ListItems count in all the lists of a SharePoint site through Silverlight Client object m

Hi All, I need to get the count of the ListItems in all the lists in my sharepoint site. This is my coding

 How much ever i try I'm getting an exception " The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested."

how to get current user permission,all permissions in share point site using object model



how we will get current user permission using object model to a site/subsite

how can show all permission under a subsite in share point.




How to ger share point sub site Ownr Name & Email using Object moel



i am sending request to the subsite owner so that time Current user like Requestor don't have permissions,but i need to send some information to owner.

Thanks & Regards


Not able to open the site with the URL when using Sharepoint object model


Hi ,

I have two different servers  windows sever 2003 and windows server 2008 where i am working with , i am using sharepoint object model to open a sharepoint site where it is working fine in the windows server 2003 , where in as when i use the same code in windows server 2008 , i am getting the error messsage as stating

The Web application at http://.................      could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

any answer would be greatly appreciated.

Thanks in advance.



Retrieving Data from a Multi-Authentication Site Using the Client Object Model and Web Services in S

Learn to add an additional header to your request when programmatically accessing a SharePoint site that uses multiple authentication providers.

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Take a tour of your SharePoint site

What is a SharePoint site for?
A SharePoint site is a Web site that provides a central storage and collaboration space for documents, information, and ideas. A SharePoint site is a tool for collaboration, just like a telephone is a tool for communication, or a meeting is a tool for decision making. A SharePoint site helps groups of people (whether work teams or social groups) share information and work together. For example, a SharePoint site can help you:

Coordinate projects, calendars, and schedules.
Discuss ideas and review documents or proposals.
Share information and keep in touch with other people.
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