VS 2010 - Restoring Entire Listbox From Session Variable

Dec 31, 2011

In my opening page of a web app I create (from a database get) two somewhat large datasets for 2 listboxes. I populate and databind them and all is good with the world

I then want to take those 2 listbox datasets and put them into a session variable for use on other pages of the web app. The reason is I do not want those additional hits in populating the two listboxes again (data does not change)

I am calling a class and passing back a DATASET for each listbox .. then

Session (DATASET_1) = MyClass.Dataset1
Session (DATASET_2) = MyOtherClass.DataSet2
DATASET_1 AND DATASET_2 are defines as constants with a type of DS

When I attempt to rebind the listboxes as

ListBox1.DataSource = Session( DATASET_1 ) *AS System.Data.DataSet ListBox.DataBind()

and the same deal for listbox 2 nothing happens........

View 5 Replies


Similar Messages:

VS 2010 - Storing Sensitive Information In A Session Variable?

Dec 17, 2010

I am creating a website that allows users to login to their gameserver remotely and send / receive commands. The connection happens via an UDP socket and requires simply the IP of the gameserver, and a password.

On my website, users can add servers to their accounts, where the server IP and password are stored in a database. Then they can connect to any of their servers, which creates a new Socket object and connects to it using the IP and password of that server.

This Socket object, embedded in an object that also stores the server IP and password, is stored in a Session variable when the user connects, and is retrieved on every page. For example, there's a page where the user can view a list of the players on the server (and kick/ban them), a page with server settings, a page with messages, etc. All these pages require the Socket connection to get their information (they send a certain command and parse the response). When I need to send a command via the socket, I need to send the password of the server each time (otherwise it does not work). My question now is: how secure is this? The password of a server is sensitive information*, but I am storing it in a session variable and sending it (using the Send command of the Socket object) to the server.

i think the Session variable is stored on memory on the server, so I don't think so, but I'm really unsure about these kind of things and I'd like to be certain that my website is secure. Well, I think it will never be 100% secure but I want it to be at least not worth the effort for someone to hack the password. If it takes a lot of trouble then people wouldn't bother, but I don't want to find out that people's passwords are being thrown out on the street (so to speak) and that my website is completely insecure...

View 6 Replies

How To Store A Value Into A Session Variable And Load From That Value Back From The Session Variable

Nov 22, 2010

Currently in an .aspx file, I am storing a value (filename that was created in that session) in an hidden text box. When the user clicks on the "Print" labeled Hyperlink control, it opens the file that was stored in the hidden text box control. But when the user goes to different screen (in the same session), I loose the filename value that is stored in the hidden text box control. So I would like to store the filename variable in a session variable. So that if the user leaves this .aspx file and comes back to this .aspx file I can load the value into the hidden text box from the session variable.

View 11 Replies

VS 2010 - How To Make Entire Grid Read Only Programmatically

Oct 5, 2011

How do I make the entire grid read only programatically?

View 7 Replies

JQuery :: Grab A Global Variable Or Session Or View State Variable In The Javascript?

Dec 9, 2010

can we grab a global variable or Session or View State variable in the javascript or using jquery?

View 2 Replies

State Management :: Public Variable Vs Session Variable To Store Logged In UserID

May 17, 2010

I have a web application which uses a session variable to store the logged in userid. If no user is logged in, of course this variable will be empty and the contents displayed on my website are meant for guests. If there is a user logged in, the user specific controls/access/links will then be a displayed.

I am now having issues with my hosting where on shared application pool, the worker recycle is triggered every 90 minutes, this will clear sessions causing all my users to be logged out. I opted for a dedicated application pool, which got worse because I am only allocated 50MB memory limit and if this is reached, the worker recycle is triggered and I lose my sessions again. I have tried as much as possible optimization techniques, e.g. dispose where possible, close connections, disable viewstate for static controls etc but my memory per instance keeps building up from page to page without any signs of improvement. I don't use loops nor store huge objects like bitmaps etc but my sessions are now gone even faster than 90 minutes in shared application pool before.

I have considered using SQL Session State but there isn't a simple guide on using this with MySQL. I am getting desperate and considering using a public variable, a string as a replacement to store logged in user id instead of in a session variable. I am pretty sure this will solve my issue with sessions being recycled but are there any negative consequences of doing this? One problem I can think of is if the user closes the browser, the system will never know that the user is now logged out and this public variable should be nothing. In this scenario, will the GC eventually clear this abandoned public variable.

View 10 Replies

C# - Temporary Or Session Variable - Want To Add A Decimal Number To This Variable

Dec 2, 2010

What would be the proper syntax in ASP.NEt 3.5 C# to assign a TextBox value to a temporary or session variable to be manipulated (added, subtracted, multiplied, divided) at different points in the application? I want to add a decimal number to this variable in almost every instance as well.

View 3 Replies

Which Is The Best Usage Session Variable Or Global Variable

May 25, 2010

I have the dataset. in this i am having total 20 tables with huge amount of data..I want use this data over all the page..so where i can keep this data..

before i used viewstate but the viewstate data is render to page every postback ..so this time the page size is increasing(interanlly viewstate is rendered to page)..so performence wise it was very slow..

Now i change my logic insted of viewstate to i used Globel Dataset on Page Level.. now the performence wise better than viewstate..

i used Like shared dsControls as Dataset at top of the page..so every time i use this dataset..

my quesation is session is better or Globel variable is better way use in my situavation..

View 3 Replies

State Management :: Global.asax To Load Up Several Session Variable When A Session Starts?

Sep 14, 2010

I added the following code to global.asax to load up several session variable when a session starts. I'm assuming that when a page goes to use the variable that I should be

1) checking at the page level that the value is valid not 0 when its not expected to be 0, not a zero-length string when its expected to have a length

2) have code at the page level that sets the values if the values have not been set as when the Session timeout, ideally putting the code in a class derived from Page and then deriving all of my pages from the new class so that the code does not have to be repeated in every page

[Code]....

View 7 Replies

State Management :: Session Variables And Tabs / Is There A Way To Reset The Session Variable

Nov 11, 2010

I have some code in my page load event where I just want to fire once when the user opens the Browser. The only issue is if you open a new tab with the same website the session variable does not reset. Is there a way to reset the session variable when you open a new tab or do you have to take the whole web browser down for it to clear the session variable.

In Global Page:

[code]....

View 2 Replies

State Management :: Session Variable Persisting Even After Abandoning A Session - Closing Browser Windows

Aug 5, 2010

I have been spending a better part of a week trying to track down why I am not able to clear all session variables in a web app (vs 2010, vb.net). What I have tracked it down to is that when I remove or abandon sessions that my html pages or codebehind access, it works, but for some reason in any of my class files where I use "Public Shared strConnection as String = HttpContext.Current.Session("strConnection").ToString" to access a session variable, it finds the old one and not the current one. I have to wait for it to time out, go in again, and it will find the new one.

I do not use Linq, and there is only one place in the whole web app that I place the connection string in a variable whcih is when a person logs in. It points them to the correct database. The sqlconnection is set for all of my listviews in Page_Init to make sure that they aren't using any session variable that they create on their own. Interestingly enough that if I use debug to go in each time, exit debug, enter debug again trying to access a different database, it works correct each time. I assume that debug is correctly killing the session variable for the classes for me.

View 4 Replies

AJAX :: Cascading Dropdownlists / Tried A Session Variable But It Comes Up With Session Is Null?

Jul 29, 2010

I have some cascading dropdownlists using the ajax toolkit I have a set up datatables in an xsd file. Then use these in a webservice to populate all the fields ... this all works great but now i need to pass an additional paramter to the first dropdownlist ( a date) but don't know how to do this? The method is below...

[Code]....

The other code is:

[Code]....

The first change would be to the tableadapter to add a param to the code i.e

AuditWebDS.TeamsDataTable teams = teamsAdapter.GetTeams(calldate);

but how do i get the calldate param to the webservice method... i tried a session variable but it comes up with session is null ? Is there another better way?

View 1 Replies

Session Timeout With Form Authentication - How To Display An Modal Poup Or Redirect Entire Webpage

Apr 1, 2010

I am using asp.net mvc and jquery to make ajax requests and when the session times out after an ajax request the full sigin page gets loaded into my ajax div.

How can I display a modal popup instead of making a redirect when a session times out?

View 2 Replies

State Management :: What Is Session And What Is Session Variable

Apr 21, 2010

I am new to asp.net Can you please guide me what is session and session variables ? Please I don't need a comparision of asp session and asp.net session because I don't know anything about asp. I have saw many articles on types of session as well. But still I cant understand exectly what is session and what are session variables in asp.net ?

View 9 Replies

VS 2010 - Adding Items To ListBox

Jul 12, 2011

I've never built an ASP.NET application. At my work, we have a bunch of different PDFs, Word and Excel documents, HTML pages, etc, all in one folder. My boss has tasked me with creating a web app to combine all of these items into one interface.

Among the things I'm adding, I need to convert a VB app I made. All the app does is scan our servers for log files and displays them in a ListBox.

Before I start importing the classes and setting up the code, I decided to just add a ListBox to the page and add a ListItem during page load.

VB.NET Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    Me.lbLogs.Items.Add(New ListItem("Test", "C"))End Sub

But, an exception is thrown when I try to run it.

The example I'm using there is the example shown on MSDN. Why this is occurring?

View 13 Replies

VS 2010 - SelectedValue Of ListBox Always Null

Sep 29, 2011

I got this in my page:

Code:
<asp:ListBox runat="server" ID="lstCategories" SelectionMode="Single"></asp:ListBox>

I populate it in my code-behind correctly, and when I look at the generated source it's:

Code:
<option value="1">aaaa</option>
<option value="2">bbbb</option>

However, in my button click event, when I check waht is the selected item's value (lstCategories.SelectedItem.Value, also lstCategories.SelectedValue) I find that the selected item is always null.

the user can only select one item in the list for what it matters. (SelectionMode = Single)

View 2 Replies

VS 2010 / Refresh A Database Query And Listbox?

Jun 30, 2012

I have a dropdown list which provided input to a SQLDataSource query which is bound to a listbox. When the user changes the index of the dropdown box, I want to trigger the SQQLDataSource to requery the database, and repopulate the listbox.

I have set the autopostback = true for the dropdown box. I have also added a Response.Redirect back to the same page in the SelectedIndexChanged method, but the DataSource does not Repopulate. How to trigger the requery?

View 1 Replies

VS 2010 - Adding Index To Listbox Values During Population

Jun 27, 2014

I have a SQL table used by a third party application that I have very little control over. The table contains a list of assemblies and their corresponding serial numbers. The tables primary key is a composite of the assembly number and serial number. There is no field I can use, reliably as an index.

I have an application I'm working on that pulls all the serial numbers from that table based on the assembly in a SQL View. I've then written code that pulls the serial numbers from that view based on the part number in a textbox on the form. That functionality works fine but I had both my datatextfield and datavaluefield set to the serial number. I've created another empty listbox that I would like to populate from a serial number or serial numbers being selected in the first. That is not working, I believe, because there is no index for the list.

My question is...How can I add an index value to each serial number as they populate from the SQL table. I've included the code below that I have pulling the serial number values.

This is an ASP.net VB webform.

Code:
Private Sub FillSnAvailList()
Dim strconnect1 As String = ("Data Source=MyDataSource")
Dim con1 As New SqlConnection(strconnect1)
con1.Open()
Dim cmd1 As New SqlCommand("SELECT [sPartNum], [SerialNum] FROM [V_MaxSerialNum] WHERE ([sPartNum] = @sPartNum)", con1)

[Code] ....

View 3 Replies

Web Forms :: Session Variable In VS2010 - Error "Session Is Not Declared"

Jun 15, 2010

I'm working on converting the TailspinSpyworks shopping cart Joe Stagner wrote in C# to VB using an evaluation version of VS 2010. I have the following public function:

Public Function GetShoppingCartId() As [String]
If Session(CartId) Is Nothing Then
Session(CartId) = If(System.Web.HttpContext.Current.Request.IsAuthenticated, User.Identity.Name, Guid.NewGuid().ToString())
End If
Return Session(CartId).ToString()
End Function

For Session in Session(CartId) I'm etting the following error: 'Session' is not declared. It may be inaccessible due to its protection level. For User in User.Identity.Name I'm getting the same error: 'User' is not declared. It may be inaccessible due to its protection level

View 7 Replies

VS 2010 - Display Contents Of A File Selected From ListBox Into Text Box

Jul 18, 2011

I need to display the contents of a file selected from a ListBox into a text box. When I populate the ListBoxItems, I set the Text property to the name of the file and its full path to the Value property.

When I click the item, the page refreshes because AutoPostBack is on, but nothing happens. I then tried this:

VB.NET Code:
Protected Sub lbLogs_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lbLogs.SelectedIndexChanged      Me.txtServiceTag.Text = Me.lbLogs.SelectedItem.TextEnd Sub

But it still didn't work.

View 18 Replies

Retrieveing Multiple Values From Session To Populate ListBox?

Jan 9, 2011

I am trying to retrieve multiple values from the session variable in which I stored the values as List. Here's the code I applied but this gives me only the lst value from the list in the output.

Array k= yourlist.ToArray();
for (Int32 i = 0; i < k.Length; i++)
{
Int32 x = Convert.ToInt32(k.GetValue(i));
SqlCommand cmd2 = new SqlCommand("select id,name from plugins where id =" + x, con);
SqlDataReader dr2 = cmd2.ExecuteReader();
if (dr2.HasRows)
{
while (dr.Read())
{
ListBox2.DataSource = dr2;
ListBox2.DataBind();
}
}
dr2.Close();
cmd2.Dispose();
}

View 2 Replies

Two Different Users Seeing The Same Session Variable?

Dec 6, 2010

It has been reported to me that a user logs into our web application and after supplying the correct credentials for themselves, are taken to the next page where they see a different customer's name at the top of the screen.

All the data at the top of our web pages is stored in session variables. The login page executes a Session.Clear statement in the Page_Load event. The user enters a username and password which is validated against our supplied database via an SQL statement. Once the user is proven to be valid, session variables are set to hold the Customer's name, as well as a few other details about them.

This is a fairly simple application, consisting of only of about 10 different pages. I am only tracking about 5 session variables per user. The session variables are initialized to either 0 or "" in the global.asax file in the Session_start routine. Upon clicking a "log out" link on any page, the login page is displayed again (executing the Session.Clear statement).

We have roughly 400 users logging into this site about once or twice a week each. The site is hosted on a server running Windows Server 2008 R2 Standard and IIS 7.

Of all 400 users, this strange session behavior has only been reported to me on a couple of occasions.

I have tried to duplicate this behavior and have not been able to. Has anyone ever heard of this? Where should I be checking for solutions? I have already checked my SQL statement and database for user authentication to make sure it is working correctly.

View 13 Replies

Subtracting From A Session Variable?

Dec 3, 2010

I have a session variable with year stored in it and in my if condition I want to check if the current year is one less than the year in the session variable like this:

[Code]....

This isn't allowed though. It says operator '-' cannot be applied to operands of type object and int. How would I do this subtraction?

View 3 Replies

Session Variable Not Being Updated?

Apr 15, 2010

I have a three step wizard. On the first step I use a repeater to create a series of buttons that an individual can select from. When the user selects one of the buttons the value of the button is saved to session state. They are taken to the next step and shown a similar list of buttons that are based on what they previously selected. Thus, if you choose "Hamburger" you might receive the options of "onion", "lettuce", "tomato" while if you choose "Hot Dog" you might receive "sauerkraut" and "ketchup".Lets say an individual chooses Hamburger. This is saved into session state like so:

Public Sub Button_ItemCommand(ByVal Sender As Object, ByVal e As RepeaterCommandEventArgs)
' ******** Lets pass on the results of our query in LinqDataSource1_Selecting.
Session("food_select") = RTrim(e.CommandName)
Wizard1.ActiveStepIndex = 1
End Sub

Now, this works fine and dandy. But lets say I select hamburger and then realize I'm really hankering for a hot dog. I go back to the first wizard step and click on the hot dog button but when the wizard progresses to the next step I still see the options for hamburgers! The session variable has not been updated.

View 2 Replies

Session Variable Getting Lost?

Sep 22, 2010

Given this Global.asax.cs:

using System;
using System.Web;

namespace Foo.Web {
[code]....

User hits webapp and is shown Introduction.aspx

User continues using webapp for a few minutes (ASP.NET_SessionId: ublbhu45ji31e055ywqu0555)

User falls idle (doesn't perform any postbacks) for a few minutes

User performs postback

User is shown Introduction.aspx
Second inspection of user's ASP.NET_SessionId cookie still shows ublbhu45ji31e055ywqu0555

Why is the user shown Introduction.apsx the second time inside the same ASP.NET Session? I'm familiar w/ the risk in setting session variables just before a redirect in the same postback, but that doesn't apply here, right?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved