.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

Diff. b/w using object tag and application variable

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :ASP.Net

What is the difference between using Static object collection (<object runat="server" scope="application" ID="MyInfo"   PROGID="MSWC.MYINFO">  </object> )  and using Apllivation variable (Application["Id"]=2;) to store application state. Are there any advantages and disadvantages in these two methods.

View Complete Post

More Related Resource Links

How to send any collection object from .NET Application to object variable created in SSIS Package


HI All,

I have a question regarding SSIS -- How to send list object from .NET Application to object variable created in SSIS Package. In List object there are one lack records stored..This list object needs to be passed to SSIS Package. Please reply me back with any suggestion/solutions ...Required ASAP.

Waiting for your replies.





is application variable is overwritten?



in my website i have stored logged in user name into one application variable;

ie;Application["uname"]="Sam"; just like this.

where "sam" is user name taken from table when he logged in.My doubt is that,is another person is log in at same time in different computer then the application variable is overwritten or not?

is there is only one application variable is created for every user?


for each user different instances of same variable is created ?

pls,help me....

Managing business object locks on application level

Today I worked out simple application side object locking solution for one server scenario. My motivation came from ASP.NET architecture forum thread How to solve concurrent site issue where one user asks for locking solution that works without changing database. Here is my simple and primitive solution that should help this guy out. I added also sample solution to this posting. My solution is simple: Create class for locked items. Create manager class that holds locks and manages them. Clear locks when session ends. Create page to release all locks. If you need something more serious then you should keep locks information in database or better than that - use some lock server. Also you may consider developing WCF service. LockItem class As a first thing let's create class that keeps lock information. I call this class as LockItem. This class doesn't hold references to locked objects - only type and ID as there are many business layers that doesn't use globally unique identifiers for objects. public class LockItem {     public Type ObjectType { get; set; }     public int ObjectId { get; set; }     public string SessionId { get; set; }     public DateTime LockedAt { get; set; } } LockItem class also contains property for session because otherwise it is not possible to kno

trust outlook 2003 application object when sending email c#

i am using outlook 2003 to send email but this outlook version always not trust application option so that before send email, always prompt a security dialog box to ask me to send email or not. how can i trust all outlook application object using vs 2008 or set in outlook 2003 anyone help

Using a Variable in SSIS - Error - "Command text was not set for the command object.".

Hi All, i am using a OLE DB Source in my dataflow component and want to select rows from the source based on the Name I enter during execution time. I have created two variables, enterName - String packageLevel (will store the name I enter) myVar - String packageLevel. (to store the query) I am assigning this query to the myVar variable, "Select * from db.Users where (UsrName =  " + @[User::enterName] + " )" Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, enterName,. I select that and when I click on OK am getting this error.   Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E0C  Description: "Command text was not set for the command object.". Can Someone guide me whr am going wrong? myVar variable, i have set the ExecuteAsExpression  Property to true too. Please let me know where am going wrong? Thanks in advance.

Sharing Application-object in subdirectories


I have a large constantly growing website, which I would like to re-organize into subdirectories. However, it seems that if I create a subdirectory and put some pages there, I'll loose the Application object. Obviously ASP.NET handles each subdirectory as a separate application. Is there a work around for this? Configuration option or something?

Any other suggestions how to organize the site?


how to store the values in a object variable (package level scope) in a script component

I have declared a variable of object type with package level scope.  I want to assign values to this variable inside a script component.  My object should hold 5 columns in a row.  How to implement this ?

How would I set a Enviroment Variable on Several remote Machines from one Application

I think my title covers the high level, but for indepth; i need to be able to connect to a machine through and ip and set a enviroment variable, i have over 60 machines in different states all on one network that i need to do this for as well as someother things for the machine. currently this is being done through a PCEXEC command in a batch file they want more control on how this operates. I just really have no idea where to even start looking for the enviroment variable change(setting one on a machine that the app is running is simple we all know that. but on a external machine im lost) on a remote machine. any one have any ideas.

Unable to Create Object Variable for Linq Data Class


For some unknown reason I suddenly am unable to create an object variable for a Linq Data Class. If I create a new project and try the process again with the same database everything works as advertized.

The code I am using is Dim db As New RoggDataContext  which gives me an error on the object variable "db": Overload resolution failed because no accessibility 'NEW'  accepts this number of arguments.

I have looked inside every file in the Web Project like the web config to check the connection string, gobal, and designer.vb looking for any errors whit no JOY.  I also tried to create a new form and code behind with a button and received the same error.

This is mind blowing because as I already stated, I can create a new Web Site and the problem goes away.

Any help is appreciated!



Casting transparent proxy of office application to the real object



1. I am using .net remoting to accept an office application (Excel,Word,PP)

2. the server is a simple office addin that supplies the application object

3. the remote object is application object wrapper (to enable MarshalByRefObject inheritance)

4. When the client gets the application object its type is Proxies.__TransparentProxy for all 3 applications

5. The problem is when trying to cast the transparent proxy to the real objects types

Microsoft.Office.Interop.PowerPoint.Application for PP

Microsoft.Office.Interop.Word.Application for Word

Microsoft.Office.Interop.Excel.Application for Excel

 the cast fails for Word  and PP whereas for Excel it works perfect

6. Since I also own the server code (the office addin) I can check what is the application

Closing a WPF form from another thread?? The calling thread cannot access this object because a diff


I have a WPF form with a Close buttom which just does


I also have a public method in this WPF form which goes like this

public void doClose()

doClose() is supposed to be called by other classes but I keep getting this runtime error when this method is called:

The calling thread cannot access this object because a different thread owns it.

Please tell me how to solve it.



1 + 1 = 3

session variable and multiple web application instance


 I have a web application using window authentication. There are a search page and a edit page in the application. 

In search page, user can enter some search criterias in the textboxes and the search result will be displayed in the gridview by clicking the "Search" button. User can select any row from the gridview and it will take him to the edit page. 

 In the edit page, there is a "Back" button to take the user back to the search page. I use session variables to remember what the search criterias the user entered in the textboxes and what page number the user was in the gridview. So when the user goes back to the search page, the textboxes are pre-populated with the search criterias and the gridview is displayed in the correct page number.

The problem is:

If user1 opened one browser window and did a search using search criterias1, then user1 opened a 2nd browser window and did a search using search criterias2. When the user1 went back to the search page from the edit page using the first browser window, all the textboxes and page numbers are from the 2nd browser window, instead of the 1st one.

Can anyone explain this problem to me and how to prevent it? It will be helpful too if you can give me some links about the similar problem.

Updating a table using a variable object


I have a variable of Data Type 'Object'. I populate this with 1 row of data via an Execute SQL Task control,  because I have a For Each Loop Container around this Execute SQL task control that gets 1 ID at a time. What I want to do is now that I have the row of data in my variable object, is update my table with the new data.

I am thinking I need to start with a Data Flow Task? But I'm not sure how/what to use to reference my variable so that I can map it to my destination.

Silverlight Application using Sharepoint as a datasource using the Client Object Model



In my scenario i have a Silverlight application hosted in ASP.NET. I want to push/pull data from a sharepoint site using the Client Object Model. Is this possible?

Notice that i don't want my Silverlight app as a web part...it is hosted in asp.net and just uses Sharepoint 2010 as a data source. Will the Client Object Model work here or are sharepoint web services the only way out??. I can host both the SL app and the sharepoint site in the same domain if required...

Please advice





Nested GridView Control returns "Object variable or With block variable not set" when outer GridView


Nested GridView Control returns "Object variable or With block variable not set" when outer GridView returns rows.

The Nested GridView Control works as long as the outer GridView returns rows, the following code works:


Protected Sub GridViewReport_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewReport.RowCreated

          If e.Row.RowType = DataControlRowType.DataRow Then

                 Dim myStatus_ID As SqlDataSource = CType(e.Row.FindControl("sqlDeviceStatusAssign"), SqlDataSource)
                 If Not e.Row.DataItem("Status_ID") Is Nothing Then
                                  myStatus_ID.SelectParameters(0).DefaultValue = e.Row.DataItem("Status_ID")
                 End If

       End If

Variable types are strict, except for variables of type Object- SSIS 2008


Hi , I declared a user variable MINIODate  as string in package level and assigned this variable in an execute sql task 2008 , where my source is ado.net and sql command is Select CSTR(MIN(IODate) ) as MINIODate  from IOData ( This is source table available in MSAccess DB) , The above senario working fine in 2005. During the run time in 2008  i am getting the following error

[Execute SQL Task] Error: An error occurred while assigning a value to variable "MINIODate": "The type of the value being assigned to variable "User::MINIODate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

Access property of object as session variable as declarative datasource parameter value


I am storing a custom "Organisation" object as a session variable. One of the properties of  the Organisation object is "OrganisationID" (integer).

I have a DataSource that requires a parameter value to run, and I want to use a SessionParameter to populate this. In a previous version, I stored the OrganisationID directly as a session variable. In that case, I could easily access it like this:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    SelectCommand="spGetUserJobList" SelectCommandType="StoredProcedure">
        <asp:SessionParameter Name="OrganisationID" SessionField="OrganisationID" Type="Int32" />

However, how do I now access the OrganisationID property of an "Organisation" type session variable (called "Organisation")?

 I have tried this, which does not seem to work:

<asp:SessionParameter Name="OrganisationID" SessionField="Organisation.OrganisationID" Type="Int32" />


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