C# - Using Sessions In Classes?

Jan 31, 2011

have code that's using session variables; it's both in the master page code behind and in the code behind of some aspx files. I wanted to put this code in a function that's in a different file but when I did that, the statement Session["VariableName"] became underlined in red on the word session. What am I missing?

View 1 Replies


Similar Messages:

Visual Studio :: What Is The Difference Between Designer Classes And T4 Template Generated Classes

Jan 11, 2010

I am new to LINQ. when we drag tables we get a dbml file and designer file.

For example DataClasses1.dbml and DataClasses1.designer.cs.

Once we have them then we can start using our LINQ Queries.

In my company project I do not see this designer files and instead there are .tt files which were used as templates to greate ABC.generated.cs files. Is this same as designer class?

View 3 Replies

C# - Class Structure With LINQ, Partial Classes, And Abstract Classes

May 17, 2010

I am following the Nerd Dinner tutorial as I'm learning ASP.NET MVC, and I am currently on Step 3: Building the Model. One part of this section discusses how to integrate validation and business rule logic with the model classes. All this makes perfect sense. However, in the case of this source code, the author only validates one class: Dinner.

What I am wondering is, say I have multiple classes that need validation (Dinner, Guest, etc). It doesn't seem smart to me to repeatedly write these two methods in the partial class:

[code]....

This doesn't "feel" right, but I wanted to check with SO to get opinions of individuals smarter than me on this. I also tested it out, and it seems that the partial keyword on the OnValidate method is causing problems (understandably so). This doesn't seem possible to fix (but I could very well be wrong).

View 1 Replies

C# - Can Base Classes See The Protected Fields Of Derived Classes

Aug 11, 2010

I don't know if this has to do with how FindControl works or how scope works. But my base class is having a hard time seeing the fields of child classes. Currently I'm planning have the derived class set a property in the base class, but there are a lot of derived classes, so that isn't a very attractive solution.

[code]....

View 4 Replies

Web Forms :: Using C# Classes Vb Classes Together In VS2008 / 3.5 Project

Mar 24, 2010

Can I use VB and C# classes together in the same asp.net 3.5 project?

View 3 Replies

Map Model Classes To ViewModel Classes Or Aggregate Model Classes In ViewModel Classes

Dec 15, 2010

I'm curious as to what people consider better practice, between duplicating model structure in the view model and using a mapping tool to move data between the two, or aggregate the model inside the view model, i.e. have a property on the view model class that is a reference to the actual model. Which is considered a better approach in general?

View 1 Replies

How Does IIS Recognize Different Sessions In .NET

Aug 19, 2010

Suppose I have logged into an application which is running from IIS. Now I haven't logged out, but closed the browser. And when I'm accessing the application again, it defaults to the login page. How does IIS recognize that it is a new request and redirects the user to the login page?

I have another doubt. Suppose if I'm not closing the browser, which I used when I logged in. I'm opening the new browser to request a page from same application. IIS recognizes that it's a new request to the application and redirects the user to login page. Why does it not use the existing session or cookies which the first browser uses?

We say http is a stateless protocol. Once the page is requested i have logged in.And http protocol connection will be terminated between IIS and browser right? Then iam navigating to other pages in that logged in application. Now iis recognises user has logged in this browser. But when i open a new browser and request that application how does iis recognises it is a new request. Since the http protocol is disconnected, how it works in the first case

View 3 Replies

MVC :: Really Need Help With Sessions And Lists

Dec 13, 2010

I have tried everything for weeks with this now but can't get it to work. What I'm trying to do is to store an array in a session and add numbers when a user guesses. I also have to know how to loop through the array.

Please help

[Code]....


View 1 Replies

C# - How To Share Sessions Between PHP And ASP.net Application

Mar 30, 2010

My company took some old php application over. Due to our preference to ASP.net and to the lack of any documentation from the previous developer, we do not want to spend much resources on developing in PHP. For implementing new features, we will create an Asp.net application that has the same look to the user. We want to develop a kind of 'coexisting' web application. Therefore we must share sessions between an PHP and an Asp.net webapplication project, because there is a usermanagement involved with an existing MySQL database.

(e.g. link 'A' directs to the PHP website, and link 'B' directs to the asp.net application)

How can we share the session between and PHP and an asp.net application?

And does anyone have a hint for this 'coexisting' thing, that might be useful in development?

View 5 Replies

Implement User Sessions In .net C#?

Nov 13, 2010

I am developing an application for Online Examination. Once a user logs into the system, he is allowed to start a Test; on clicking start test button the user is redirected to the questions page. Now when the user clicks and confirms ending of the test by a button click then he is redirected to the results page.Now what I want here is that when the results page is being displayed the user should automatically be logged out of the system and should not be able to go back to the previous pages by pressing the browser's back button.

The problem which I am facing right now is that when the results page is displayed anyone can press the back button and continue the test and manipulate the result. How can I stop this.

View 4 Replies

Difference Between Viewstate And Sessions?

May 6, 2010

i want to know what is the difference between viewstate and sessions.

View 2 Replies

User Sessions Override Each Other

Oct 21, 2014

I have a Asp.net web application that is running on 4.51 , When the User login Successfully i return an Object that has info for that user and store this in a Static object. Now my problem is the i

User 1 Login (Welcome James)

and

User 2 Login (WelCome Daniel)

and User 1 refreshes the Page (Welcome Daniel)

My user sessions override each other. i did mess around with the IIS Session before , i just noticed this now.

View 1 Replies

VS 2005 Lost Sessions After 30 Minutes?

Mar 24, 2010

I have an application using login-controls.

I have this code in my webconfig:

<authentication mode="Forms" >
<forms loginUrl="default.aspx" protection="All" defaultUrl="index.aspx" timeout="100000"></forms>
</authentication>

My problem is:

If I do not activate my application for 30 minutes (my customers wants to be online all day without logging out) my session for user login is lost. How can I automatically refresh my sessions if there has been no activity for e.g. 10 minutes? It's a sort of keep-alive that I want. I thought the problem was sloved when I set the timeout to 100000 but it doesn't help

Note. My application works with the remember me function but it losses its sessions after 30 minutes.

View 8 Replies

How To Find Information About All Sessions For A Web-app / Site

Jul 23, 2010

I am trying to create an admin screen that will give me details about all open sessions in an application/site. I would also like to know how many session objects are active for each of them

Session object gives me info about my current session. How do i find info about all open sessions. How many sessions are active, etc.

View 1 Replies

How To Configure SQL Server To Manage Sessions

Feb 2, 2011

I need to know how to configure the .config to manage Session state in SQL Server

View 2 Replies

Site Uses Cookies - Need To Switch To Sessions

Nov 17, 2010

My site uses cookies. I need to have it use sessions instead. The reason for this is because there is a third party that needs to connect to it, and it's always requiring 3rd party cookies to be enable in the browser and that is annoying my customers. Is there any other way around this other than switching to sessions?

View 4 Replies

HttpContext.Current / Cache Available To All Sessions

May 4, 2010

As per title. I want to be able to save some data in a cache object but this object must be available to all users/sessions and can expire.What is the best method to achieve this in a asp.net web app?

View 2 Replies

State Management :: Read Value From A One Sessions Value Into Another

Feb 22, 2011

1. I am using Session to maintain some value. I have to read some value from a one sessions value in another session. Here I think i can maintain it using cookie or maintaining the session in state server or sql server. but I want to know is there any other approach in maintaing the state in client side .

2. I have set the session variable in page load . after that i am trying to access the session value in web service consumed by that webiste. but I was not able get the same session in web service. can i know what is work around I need to do for getting the same session in web service also.

3. I need to bind a gridview using javascript ,Can i create the source for binding to it in javascript itself. i mean like datatable.

View 5 Replies

Iis - One Application, Different Domains: How To Preserve Sessions

Mar 18, 2010

I have an application with different sections. Each section is accessed through a domain. Example:

[URL] I need to preserve the session when the user navigates from one to another URL. The application is the same in IIS. How to accomplish that?

View 5 Replies

State Management :: Alternatives To Sessions?

Nov 2, 2010

i have a situation where worker process recycling is causing session to expire and loose all the session data. Change to State Server and SQL server seems to be very complicated and impossible beacuse we use third party objects which are non-serializable. We need to let users keep running our ship tracking website for weeks or months beacuse they use it in their lobby and they do not want to touch it again. What alternatives i have if worker process recycles which causes to loose session data. I will need to atleast retain their user id and password to autologin them incase session expires.

View 5 Replies

Proof That Web Gardens Do Not Fly Well With InProc Sessions?

Dec 2, 2010

I am tinkering with Web Gardens in ASP.NET with IIS 6.0. Multiple sources (Source1 Source2) explain how InProc Session does not fly well with Web Gardens. I built a program to prove it, but the results are difficult to explain. I set the Maximum # of worker processes to 1000 in IIS.I create a web app that stores a string in Session and retrieves the value with a button click. Run web app in IE, FF, and Blackberry browsers.

View 1 Replies

When A Few Users Try To Log Into Site - Their Sessions Are Merging?

Feb 16, 2011

i lunched an asp.net web-site. the main idea in the site is that:the site shows the same page, but on each next button the user clicks, the pictures in the site change randomly. im working with postback and sessions.

i noticed that when a few users try to log into my site - their sessions are merging. meaning, the first picture presented is diffrent but the second picture is the same for all the users, and so on... (moreover, pictures that appears in the begining appearing again even thow i don't allw it in my code)when i tried to debug the site locally, the random function works perfectly and there were no such problems. it haapens only when 2 users and more log into my site.

View 1 Replies

HttpHandlers / Modules :: Handler And Sessions?

Mar 7, 2011

I have a form with a server side button, clicking on which session variable is added Session.Add("ABC","123")After this (in same postback event), I redirect user to a site, which returns user back to my site. And I still have session "abc" available to me.NOW, In another scenario I am trying to do the same thing but in a handler. I.e.User clicks a clinet side button which redirects users to sameSite.xyz. Handler of xyz adds session variable like above and redirects user to the other site. But, this time when user returns back from other site, my session is lost. How can I imitate scenario 1 with handlers?

View 2 Replies

Pass Data Between Pages Without Sessions In MVC?

Jun 11, 2010

I have one application in which I want to pass data between Pages (Views) without sessions. Actually I want to apply some settings to all the pages using query string. For example if my link is like "http://example.com?data=test1", then I want to append this query string to all the link there after and if there is no query string then normal flow.

I was thinking if there is any way that if we get the query string in any link for the web application then some application level user specific property can be set which can be used for subsequent pages.

View 2 Replies

VS 2010 Sessions Variables Getting Lost?

Jan 28, 2012

This is my page code

Code:
Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim blnLogin As Boolean
blnLogin = Login(txtUserLogin.Text, txtPassword.Text)
If blnLogin = True Then

[Code] .....

So after the user presses the Login button there should be 3 variables stored in a session, this works (checked using trace='true')

Session State
Session KeyTypeValue
LoggedInSystem.String
LoggedInUserSystem.StringUser
LoggedInIDSystem.Int322

That's fine. Now I click on the AddToWall button to check if I can get the LoggedInID, it shows an empty messagebox.

In the trace there are no Sessions keys left.How can I make it keep the keys after postback/after clicking on buttons?

Note: When calling GetFriends(Session("LoggedInUser")) in the same sub as the Login button the variable does get passed to the class with sub GetFriends()

Here's my web.config

Code:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<sessionState timeout="30" />
</system.web>
</configuration>

View 3 Replies







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