.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

Have some error using arraylist in session to store multiple value

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
i have two buttons in user control, button1 is (like) and second is (dLike). if i click any button the count will increased in my database table by 1. our table have id,title,url,imagegalary,articleid. in everypage i take the article id as in sessioni alredy disable the links when you click once , after i went to next page and come back to the same page the button will visible how to solve this problem. how to store the multiple session values in the arraylist and display it . please anybody replay me protected void ImageButton1_Click(object sender, ImageClickEventArgs e){string ArticleID1 = GenerateArticleID();COLTools.DB.DataBaseType = COLTools.DataBaseType.SqlServer;COLTools.DB.ConnectionString = ConfigurationSettings.AppSettings["COLCMS"].ToString();string updateQuery = "update Article set Alike = Alike + 1 where Articleid =" + ArticleID1;COLTools.DB.RunSql(updateQuery);disablebutton();addtovotelist(ArticleID1);likedislike();}protected void ImageButton2_Click(object sender, ImageClickEventArgs e){string ArticleID1 = GenerateArticleID();COLTools.DB.DataBaseType = COLTools.DataBaseType.SqlServer;COLTools.DB.ConnectionString = ConfigurationSettings.AppSettings["COLCMS"].ToString();string updateQuery = "update Article set Dlike = Dlike + 1 where Articleid =" + ArticleID1;COLTools.DB.RunSql(updateQuery);disablebutton();addtovotelist(A

View Complete Post

More Related Resource Links

How to store and retrieve multiple values in a single session variable .


I want to store employee name,designation and department in session variable and
retrieve in another page how to do this.

Error: Encountered multiple versions of the same assembly with GUID...try pre-importing...TlbImp


Hi!  Can someone tell me how I can troubleshoot the following error: "Encountered multiple versions of the same assembly with GUID...try pre-importing one of these assemblies".

The website developed in VS 2010 (.Net 3.5). This error is only received on my workstation.  Another person developing the site does not experience this issue at all.  Also, not sure if this matters, but on my workstation the 'Assembly Information...' dialog contains no values even though the 'AssemblyInfo.vb' file does specify values for the title, desc, etc.  The GUID being referenced in the error is the main project of the three projects within the solution.

I tried looking through the GAC, but do not see any references to the projects or DLLs in the VS solution and am not sure what else/where to look.

If I delete the copy of the solution on my local machine and pull down a copy from source control (AnkhSVN) the solution will build with no error.  Once I make any changes, such as adding a new aspx file, then the error is received.

I can provide any additional information needed.

ReportViewer Error Asp.net Session expired

When i am connecting Report Manager report through our ASP.NET 2.0 application using Report Viewer control frequently we get message ASP.Net Session expired .              How can we avoid this error.While i directly opens Reports through the Report Manager reports are opening without any problem.   My .Net application Code. ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://SERVER/reportserver");ReportViewer1.ServerReport.ReportPath = @"/myreport/reportname";

Error using multiple webconfigure file in ASP.Net 3.5

when i using mutiple webconfigure file in .net 3.5 ,error Comes t is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

Error When Deploying Multiple Projects in a Solution

We have a solution with 16 projects, where all but 3 are Sharepoint 2010 projects. When we deploy the projects in VS2010 individually, everything is fine, but when we deploy the solution (right-click, deploy), we experience one of two problems: 1. Not all projects get deployed, some just give the following message: "Deployment was not performed for this project because it is a dependent project." 2. Some of the projects (currently always the same three Sharepoint2010 projects) give the following error during the "Recycle IIS Application Pool" step: "Error occurred in deployment step 'Recycle IIS Application Pool': The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout." We don't have any dependencies set up in the projects except for the ones which are automatically created when we add project references. If we do two subsequent solution deployments, the first one will suffer from issue 1 and the second from issue 2 as well. When issue 2 happens, the faulty projects can't even be deployed individually until VS2010 has been restarted.   A Google search has revealed nothing at all. We're at a loss and it's getting to be very frustrating for the entire team. Any help would be appreciated.   Thanks, Bjoern

i make a web site using frame but session is expire Error message is my Config file is attache

i make a web site using frame  but session is expire message is Object reference not set to an instance of an object Description: HTTP 500. Error processing request. Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 at System.Web.UI.Control.LoadRecursive () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessLoad () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessPostData () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 My Web Config file is<configuration>    <!-- store the database connection info here -->     <appSettings>        <add key="sBook_StoreDBConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Program Files\CodeCharge\Examples\BookStore\BookStore_MSAccess.mdb;Persist Security Info=False" />            </appSettings>  <system.web>  <httpRuntime executionTimeout=&quo

ScriptManager CompositeScript Error: A script reference cannot be included multiple times in composi

I am getting the following error using the CompositeScript feature of the ScriptManager.  I have ScriptManagerProxy in several different usercontrols that use CompositeScript to add whatever JS files they need.  Sometimes there are duplicates which would get removed by the script manager, but that is not happening with the Composite Scripts.  Looking at the stack trace, it calls RemoveDuplicates but for some reason it doesn't do so.  Is this a bug?  Is there a workaround or a hotfix? Thanks! A script reference cannot be included multiple times in composite script references. Stack Trace: [InvalidOperationException: A script reference cannot be included multiple times in composite script references.]   System.Web.UI.ScriptManager.RemoveDuplicates(List`1 scripts) +698   System.Web.UI.ScriptManager.RegisterScripts() +328   System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113   System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8695102   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029

Is it possible to store objectdatasource in session or viewstate to use on another page?

Im building my objectdatasource on different button events.. so id like to know if i can store that or the results in a session or viewstate so i can use it on a pop-up window. explanation: User arrives at our page. They select or enter specific information to search.. results found are presented in a gridview, that is currently bound to the objectdatasource. Within that gridview i will be adding a button to open a new window that will display a googlemap with the location marked on the map. Also will be adding a button to view all the results on the map. So if your search returns 10 records and you want to see all 10 marked on the map, they can click the "View All" button and they are all marked on the map.. Or if you want to just view 1 at a time, you select that record and it display just that record on the map.   So not sure what i should do to accomplish this.

Error handling, multiple error messages

Hi all. Have you noticed that sql server catches only last error message? Try to run this: exec('create table #t ( t1 timestamp not null default 0 )') You get: Msg 1755, Level 16, State 0, Line 1 Defaults cannot be created on columns of data type timestamp. Table '#t', column 't1'. Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors. Now try to run the same thing in try catch: begin try exec('create table #t ( t1 timestamp not null default 0 )') end try begin catch declare @Error varchar(max) set @Error = error_message() raiserror(@Error, 16, 1) end catch The error message this time is: Msg 50000, Level 16, State 1, Line 10 Could not create constraint. See previous errors. Does anyone have any better ideas how to handle sql server errors? Thanks      

Sharepoint 2007 Upload Multiple Documents error on Windows Vista

Hi all, I am having an issue uploading multiple documents from a share using the "Upload Multiple Documents" on the toolbar in a document library. The user experiencing this problem has a Windows Vista machine that recently replaced XP. They have mapped shares that they use. The shares work fine in windows explorer, but when you click the + next to the share through the "Upload Multiple Documents" function on sharepoint, the machine thinks for a while, then removes the + and shows no documents. Anyone know why this is happening?

How to catch error in session variable in globals.asax(Application_Error) and redirect to same page

Hi, i have a login page where username got to enter his/her username or password. When you try to enter any scripting over there eg:'<asd>' it gives an error  'Server Error in '/' Application' 'A Potentially dangerous Request. Form value was detected from client' I don't want to redirect user to custom error page when such unpredictable error occurs. infact i got a label on the same page itself where error's are displayed. how can i display such errors on this very same label. can i do that using globals Application_Error ?. Session variable not working here. Please give me the exact steps for how i can catch and display the error which are not validated. waiting for reply thanks and regards, Learning Programmer

Session expire error

Hi,I have Store procedure its take some times to execute, While its executing my session expires the browser seems to freeze and the user do not seem to know what to do. Instead, Could i please re-direct to the login page with a red line message saying "Your session has expired. Please login again."whats the best way to do that?krdslakmal

Weird casting error (storing Generic list in Session)


Am trying to store a generic list in Session to act as a simple shopping cart. Am getting a weird casting error when I try and retrieve it from Session.

A critical error has occurred.
[A]System.Collections.Generic.List`1[MyCartItem] cannot be cast to [B]System.Collections.Generic.List`1[MyCartItem].
Type A originates from 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    in the context 'LoadNeither' at location 'C:\WINDOWS\assembly\GAC_32\mscorlib\\mscorlib.dll'.
Type B originates from 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    in the context 'LoadNeither' at location 'C:\WINDOWS\assembly\GAC_32\mscorlib\\mscorlib.dll'.

I have a class variable defined:

List<MyCartItem> _cart;

In the Load event I have:

_cart = (Session["MyCart"] != null) ? (List<MyCartItem>)Session["MyCart"] : new List<MyCartItem>();

Session State throws error in ASP.NET Site Pages for SharePoint 2010 portal using Visual Studio 2010


I'm developing Visual Studio 2010 solution for site pages. I’ve created Site Pages in SharePoint 2010 and I’m trying to access Session variables in code behind in ASP.NET but it throws the following error.

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.

I set the page directive as enableSessionState=&quo

Session "WSSUSAGESESSION14" failed to start with the following error: 0xC0000022


Getting this error in event log. Anyone seen this before?


How can I avoid error a Insert Store proc if he don't find any coloum in a table


I have created one Insert Proc for a table which has three Colourm. 

Id int, [Name] varchar (30), Phone varchar (15) I want to use this proc for another Table which has two coloum which is semiler with first table lie   Id int, [Name] varchar (30) I want to use one Insert Store Proc For two Table. I can avoid null value of parameter but but can't avoid if the coloum is not exist. 



Access is denied error thrown in "Setup Secure Session" activity


Could someone help me with the following issue, please?

System setup:
- Windows 2008 R2 server hosting both MVC2 web application and WCF service for it;
- users connect to the web application which gets all data from the WCF services;
- WCF services are resused by several other applications (WinForms based) which work fine and have never experienced any security related problems;
- MVC2 uses impersonation (<identity impersonate="true"/>) to connect to WCF services, so we have single security boundary for both web and winforms clients (which are out of scope of the problem);
- both MVC2 web application and WCF services share the same ASP.NET v4.0 DefaultAppPool application pool, running under NetworkService identity;
- all users, user PCs and servers belong to the same AD domain, which is a part of global corporate tree;
- all unhandled exceptions are automatically caught by the web application and forwarded to application developers' e-mail box;
- WCF binding setup in web application:

    <binding name="WSHttpBinding_BifrostServices" closeTimeout="00:10:00"
     openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"

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