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

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

Ideal approach? - Shared Classes or Non Shared (Object based)

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
Whats the ideal approach while developing an  ASP .Net application.1. Using normal classes and then using their functions by making objects? 2. Using Shared (Static for C#) classes and their shared functions and accessing them without creating the objects.My questions areWhat are benefits and drawbacks of above both?Can we face issues in simultaneous access of functions in 2nd case?Will there be separate copies of functions and variables in memory for 2nd case or just a single copy?What if our SqlConnection, SqlCommand and SqlAdapter are also shared? 

View Complete Post

More Related Resource Links

Backup failed for Object Shared Search Index failed in event OnBackup.

Hi, Farm level backup completed with 2 errors on SharePoint server 2007 through STSADM command line. Error details: Error: Backup failed for Object Shared Search Index failed in event OnBackup. For more information, see the error log located in the backup directory. Error: Object Shared Search Index failed in event OnPrepareBackup. For more information, see the error log located in the backup directory.     WebException: The current operation timed-out after 3600 seconds. Debug:    at Microsoft.Office.Server.Search.Administration.SearchSharedApplication.Microsoft.SharePoint.Administration.Backup.IBackupRestore.OnPrepareBackup(Object sender, SPBackupInformation args)    at Microsoft.SharePoint.Administration.Backup.SPBackup.RunPrepareBackup(SPBackupRestoreObject node) Error: Object Shared Search Index failed in event OnBackup. For more information, see the error log located in the backup directory.     Object Shared Search Index failed in event OnPrepareBackup. For more information, see the error log located in the backup directory.     WebException: The current operation timed-out after 3600 seconds     WebException: The current operation timed-out after 3600 seconds [26/08/2010 14:23:44]: Debug:    at Microsoft.Office.Server.Search.Administration.SearchSharedApplication.Microsof

Reference to a non-shared member requires an object reference in code generated by ASP.NET



I am working on converting a project from C# to VB and am facing this weird issue. 1 page cannot compile and I get the reference error, but the weird thing is that the compiler shows the error as coming from ASP.NET generated code. Visual Studio shows me that error is coming from my ASPX page. I cannot seem to figure out why or where this error is occuring. Also if I take the inherits attribute out I don't get the compilation error. The code in aspx page is below:

<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="diff.view.aspx.vb"  Inherits="MR.ControlApp.diffview" MasterPageFile="~/Site1.Master"%>

<asp:Content ID="Header1" ContentPlaceHolderID="head" runat="server">

    Page: <select onchange="sel(this);">
        Dim j As Integer = 0
        While j < pageCount
           <option <%= IIf(currentPage = ( j + 1 ), "selected", "")  %> value="<%= j+1 %>"><%= j + 1 %></option>
        <%j = j + 1
        End While
    <% 'Print(); %>
    <div style="font-family: verdana; font-size: 10pt; font-weight: bold">
        MDM Data Inconsiste

Reference to a non-shared member requires an object reference


This is detaining me from transferring my website to another webserver.  So much for a seamless transfer. I had no problem ever with the following line on several pages on my site:

  <%Dim cust As New BusinessLogic.SiteUser(CInt(BusinessLogic.SiteUser.CurrUserID))%>

This line is used on 4 other pages just like above. The vs 2008 is whining with this error message.

I opend my 2005 vb.net site into VS 2008 and it asked me if I wanted to upgrade for .net 3.5 and I said yes. I cannot debug and I get the mentioned error. Visual Studio 2005 gives NO such error. What is the issue?  How can I resolve this?

What is a non-shared member? I don't think I should have to change anything in my business logic area. Can this line, which does 2 things, be done in the code behind? Or partly in the code behind so as to not give this error?

<%@ Page Language="VB"  AutoEventWireup="false" CodeFile="paypal_featured.aspx.vb" Inherits="paypal_paypal_featured" title="Untitled Page" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <form action="<%=paypalurl%&g

Reference to a non-shared member requires an object reference


I do not receive this error when I open my website application in vs 2005. When I open in vs 2008, I get this error. What gives?

These lines are underlined in blue:

<%Dim cust As New BusinessLogic.SiteUser(CInt(BusinessLogic.SiteUser.CurrUserID))%>

Businesslogic area is imported into each of 3 pages with this line. 

Reference to a non-shared member requires an object reference.


I cannot seem to find the answer to this error.  I have read all the posts I could find but nada seem to work.


Here's what I have


Sub Page_Load

Dim clsTest As New clsTest

     Dim myTest As String = clsTest.Test1()    <-- Error Reference to non-shared member requires an object reference

 End sub


Imports System
Imports Microsoft.VisualBasic
Imports System.DateTime
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.Data.Linq.DataContext

Imports System.Web
Imports System.Web.UI.Page
Imports System.Web.HttpRequest
Imports System.Collections

Public Class clsTest

   Public Shared Function Test1() As String

      Return "Test1"

   End Function

End Class



Thanks for your help







How to change the folder icon dynamically based on the name of folder in shared document library


I have created visual webpart ,through this webpart i am creating the folders dynamically in shared document library.

here my thing is if i create folder with specific name,want to set custom icon instead of default icon

please any one help me on this.


Advanced thanks


Installing SqlServer 2008 shared management object in Win Xp Sp3


Hello All,

I am not able to install SQL Server 2008 shared management objects,it showing me the message saying prerequisites required SQL Server 2008 System CLR Types.Even Though it is already been installed.Please help

While uninstalling i uninstalled clr types first then smo,now again while installing m able to install clr types but not smo,is this related.Please help

Thanks in advance

Public Shared function doubt????

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.


Geneva Framework: A Better Approach For Building Claims-Based WCF Services


Here we introduce Microsoft Code Name "Geneva," the new framework for building claims-based applications and services, and federated security scenarios.

Michele Leroux Bustamante

MSDN Magazine December 2008

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:


because apparently it cant find it.

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)


Enum newsFields
End Enum

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

Shared dataset in SSRS 2008 R2 running on SSAS 2005

I am trying to create a report in SSRS 2008 R2 using SSAS 2005 as a datasource. My dataset has a date parameter. When I create an embedded dataset in my report everything works fine, but when I create a shared dataset with the exact same mdx query, I get the following error: An error occurred during local report processing. The definition of the report 'xxxx' is invalid. The Value expression for the report parameter 'DateCalendarHierarchy' contains an error: [BC30034] Bracketed identifier is missing closing ']'. Does anybody have any ideas? Is this a bug? Thanks, Louis

Installing Microsoft.ACE.OLEDB.12.0 on a shared server--supported or not?

Here's the scenario: we have a Web application that needs to open an Excel 2007 file, read the sheet names and pass the sheet selected by a user to a SSIS package for processing on the DB server. During development, we discovered that the Microsoft Access Database engine (Microsoft.ACE.OLEDB.12.0) is required for our application to perform these tasks when running on a 64-bit server. Details: ASP.NET 4/VS 2010/SSIS on SQL 2008 R2; 32-bit environments have no issues; 64-bit requires installation of the provider. We followed this link to get the components: http://www.microsoft.com/downloads/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en We have installed the components and everything works great in our development and test environments. However, we must deploy to a 64-bit environment that is controlled by our customer's IT group, not by us. They are balking at installing the components because of the following statements that appear on the download page in the "Additional Information" section: "The Office System Drivers are only supported under certain scenarios, including: " Desktop applications which read from and write to various files formats including Microsoft Office Access, Microsoft Office Excel and text files. To transfer data between supported file formats and a database repository such as SQL Server; in the

online shared hosting sql server problem

 hi all             how to solve the problem in online sql server. A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)thank u

Mysql connector and medium trust shared hosting

Hi at all. I've a big problem with GoDaddy Shared Hosting. I've written an ASP.NET application with MySql Database, but my application can't run, with the "Security Exception" error. The problem is that mysql connector must be recompiled with some .... different option. But i can't recompile.. i got always error. So i'm asking you if someone have a link for a mysql connector version able to run in medium trust environment.Very Thanks in advance.Bye
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