Click here to Skip to main content
15,892,643 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to convert ? Pin
Christian Graus21-Feb-08 18:22
protectorChristian Graus21-Feb-08 18:22 
GeneralRe: how to convert ? Pin
N a v a n e e t h21-Feb-08 21:22
N a v a n e e t h21-Feb-08 21:22 
QuestionHow to Import Data From SQL server or any database to SAP by dot net coding? Pin
Shippya21-Feb-08 17:51
Shippya21-Feb-08 17:51 
AnswerRe: How to Import Data From SQL server or any database to SAP by dot net coding? Pin
Christian Graus21-Feb-08 18:24
protectorChristian Graus21-Feb-08 18:24 
Generalconfiguration error Pin
Member 387988121-Feb-08 16:45
Member 387988121-Feb-08 16:45 
GeneralRe: configuration error Pin
Christian Graus21-Feb-08 17:39
protectorChristian Graus21-Feb-08 17:39 
GeneralRe: configuration error Pin
Gandalf_TheWhite21-Feb-08 21:53
professionalGandalf_TheWhite21-Feb-08 21:53 
GeneralStoring class into session Pin
Kasic Slobodan21-Feb-08 7:58
Kasic Slobodan21-Feb-08 7:58 
I changed a way of storing user information from many session to one session object with storing a class into that session.

I have a class like:

public class UserInfo
{
    // Inside this class there are properties to store users data (all properties are public)
    string _username;
    int _id;
    bool _somePermission;

    ...
    and so on
}


When user logs in and if user have all necessary permissions, I create a new instance of a UserInfo class

UserInfo user = new UserInfo();


And then read user permissions, from database, for every page on a site and store it in each property that correspond to

user.Username = dataReader["username"];
user.ID = dataReader["id"];
user.SomePermission = dataReader["some_permission"];


And finally, store that class into session like

Session.Add("UserInfo", user);


On every page, where I need information from session, I do

UserInfo user = (UserInfo)Session["UserInfo"];


And then use

user.Username, user.ID or user.SomePermission


But, theres something wrong about it.
When I try to compile it, I get an error (marking Session)

An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Page.Session.get'


I am missing something, thats for sure, but I don't know what.
Anyone would help me with this?

Thanks in advanced.
AnswerRe: Storing class into session Pin
Venkatesh Mookkan21-Feb-08 15:43
Venkatesh Mookkan21-Feb-08 15:43 
GeneralRe: Storing class into session Pin
Kasic Slobodan22-Feb-08 10:25
Kasic Slobodan22-Feb-08 10:25 
GeneralRe: Storing class into session Pin
N a v a n e e t h21-Feb-08 21:37
N a v a n e e t h21-Feb-08 21:37 
QuestionNew window script is not working at MS Vista? Pin
Dong Kim21-Feb-08 6:56
Dong Kim21-Feb-08 6:56 
GeneralRe: New window script is not working at MS Vista? Pin
Not Active21-Feb-08 8:00
mentorNot Active21-Feb-08 8:00 
AnswerRe: New window script is not working at MS Vista? Pin
Dong Kim21-Feb-08 9:25
Dong Kim21-Feb-08 9:25 
GeneralRe: New window script is not working at MS Vista? Pin
Not Active21-Feb-08 9:34
mentorNot Active21-Feb-08 9:34 
GeneralAPPLICATION TO RUN EVERY FEW SECONDS Pin
kibromg21-Feb-08 5:28
kibromg21-Feb-08 5:28 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
J4amieC21-Feb-08 5:29
J4amieC21-Feb-08 5:29 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
kibromg21-Feb-08 5:47
kibromg21-Feb-08 5:47 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
J4amieC21-Feb-08 6:08
J4amieC21-Feb-08 6:08 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
kibromg21-Feb-08 6:17
kibromg21-Feb-08 6:17 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
Vasudevan Deepak Kumar21-Feb-08 19:19
Vasudevan Deepak Kumar21-Feb-08 19:19 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
hartertobak21-Feb-08 9:13
hartertobak21-Feb-08 9:13 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
hartertobak21-Feb-08 9:16
hartertobak21-Feb-08 9:16 
GeneralRe: APPLICATION TO RUN EVERY FEW SECONDS Pin
J4amieC21-Feb-08 22:41
J4amieC21-Feb-08 22:41 
QuestionWorking with large datasets and filtering Pin
Member 438223221-Feb-08 3:38
Member 438223221-Feb-08 3:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.