Retrieve SSL Session Id?
May 12, 2010is there any way to retrieve the SSL session Id serverside in asp.net?
View 2 Repliesis there any way to retrieve the SSL session Id serverside in asp.net?
View 2 RepliesIts related to datatable in gridview store in session and then session retrive and store to database. basically i am using gridview here creating new row for button click and these row adding untill user's last entry then submit all these entry to database. so i want to use session variable to store this data temporarily and after final entry user click on submit button and all data shold be save in db.
View 9 RepliesI have used session to the creation of user and led them to the edit page ..But how do I retrieve my userID off from the session, or are there other ways to retrieve userID from?
View 3 RepliesOn page load I am populating my own list object, storing in session & it is getting stored, When I am debugging i can see that list object is stored in session, But When I am reading that session variable in next page, it's throwing error like
The type 'Dispensary.ResourceScheduling.Views.SchedulingPopup' exists in both 'WebApplication.dll' and 'App_Web_6bndsqgu.dll'
How do I implement this session: (UserID is part of the login table)
Session["UserID"]="usrName";
Into this code?
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Odbc;
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Login1.Authenticate += Login1_Authenticate;
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
//database connection string
OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite; User=x; Password=x; OPTION=3;");
cn.Open();
OdbcCommand cmd = new OdbcCommand("Select * from User where username=? and password=?", cn);
//Select the username and password from mysql database in login table
cmd.Parameters.Add("@username", OdbcType.VarChar);
cmd.Parameters["@username"].Value = this.Login1.UserName;
cmd.Parameters.Add("@password", OdbcType.VarChar);
cmd.Parameters["@password"].Value = this.Login1.Password;
//use asp login control to check username and password
cmd.Parameters.Add(new OdbcCommand("@UserID", 'id.int'));
OdbcDataReader dr = default(OdbcDataReader);
// Initialise a reader to read the rows from the login table.
// If row exists, the login is successful
dr = cmd.ExecuteReader();
int id = cmd.Parameters["@UserID"].Value;
Session["UserID"]="usrName";
if (dr.Read())
{
e.Authenticated = true;
Response.Redirect("UserProfileWall.aspx");
// Event Authenticate is true forward to user profile
}
}
}
I need to be able to retrieve the correct UserID when some one inputs there username and password upon login and then some how retrieve it on a new page something like this to retireve it but unsure?
string usrName = Convert.ToString(Session["UserID"]);
I just dont know how to add the first part, the session into my login code so I can some how store the UserID in my session but also retrieve the correct UserID from the submitted data that takes from my mysql login table.
I have taken up a project at work that was left half finished by the last guy that used to work here, it involves choosing a country, region and town from some drop down lists this is all done in Javascript which leaves this as a problem for me so now I need to retrieve the value of the townID that is stored in a hidden value, I tried this by putting the townID value inside a session and then on postback (after clicking the button) I wanted to parse the session value to retrieve the correct article, but I receive the following error:
Value cannot be null.
Parameter name: String
Here is what I am doing with the code (on the button):
[Code]....
(Postback)
[Code]....
This is the code I am using, the TownID is coming out null!
I want to pass multiple values to another page from my gridview. For sending i got this codes : (writing same page selected values)
[Code]....
Here is my question How can i catch from another page this values?
i'm a asp.net c# beginner, i set a session variable in a.aspx but it's null when i try to retrieve it in b.aspx
my solution currently has a website project and a class library project. I am attempting to access a session object from my class library but it is always returning null. In a settings class in my class library I store these values like so:
private static SessionProperty<WebUser> _currentUser = new SessionProperty<WebUser>("CurrentUser", delegate { return new WebUser(); });
public static WebUser CurrentUser
{
get { return _currentUser.Value; }
set { _currentUser.Value = value; }
}
I can access this just fine from any aspx page codebehind like so:
Settings.CurrentUser.User.ProviderUserKey.ToString();
However, if I attempt to do the same thing from a class in my classlibrary project it always returns null.
how to store an array in session and how to retrieve that array from session?
I am trying to store one array of type Double and assigning values of the same type but it is showing me an error. How do I assign values to the array which is in session?
the dropdown list is showing data from database, but how to retrieve the selected value and store it in a session variable??
View 1 RepliesMy problem is regarding title written above. Currently I have some functions that rely on Sessions to do the job. Everything works smoothly when it is left to default. However, I do not like the idea of losing sessions in case of crash and I have modified my web.config to use Sql Server mode instead.
I have run the necessary commands to create tables and stored procedures in my database using aspnet_sql.exe. I am able to store values into the database but have not been successful retrieving them. Since it has been working fine with InProc mode, I think I can safely assume that there's nothing wrong with my codes. Here's my web.config setting:
<sessionState mode="SQLServer" allowCustomSqlDatabase="true" cookieless="false" timeout="120" sqlCommandTimeout="30" compressionEnabled="true"
sqlConnectionString="Data Source=.SQLExpress;Initial Catalog=mytest;Persist Security Info=True;User ID=mytest;Password=mytest;"/>
I have read in many places that referencing IRequiresSessionState or IReadOnlySessionState will allow me access to the Session scoped variables from within the ProcessRequest method in an ASHX file.
I have implemented these changes, as follows, and I am unable to retrieve this data still, as the server returns a null object reference error:
using System;
using System.Web;
using System.Web.SessionState;[code]....
The error is most certainly specific to pulling data from the session, yet I am 100% certain that the session contains data in this key.
It shouldnt matter where I am storing the data (cookies, vs db, etc), right?
How to retrieve the data from the session (Dataset) and save it into a database
[code]...
I'm trying to set session variables in one page, and retrieve them in my code file in the page that it posts to.
I keep getting this error. I put the correct namespaces in, and enabledSessionState = true to my application files, but no luck.
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. 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'm just calling a session variable, and I get that error
e.g,
Public AUID As Integer = Convert.ToInt16(Session("AUID"))
I want to store employee name,designation and department in session variable and retrieve in another page how to do this.
View 2 RepliesHow save and display data from local storage with angular..I want save this data example
View 1 RepliesI'm trying to make a dropdown list with data available based on the users login name. Heres what I have as my SQL Query in the SQLDataSource:
SELECT Client_Name, Client_ID FROM Client WHERE (Client_Name LIKE '%@Client_Name%')
So say if the login username is "User1" but the database client name is "User1 Steel" I want the dropdownlist to pull "User1 Steel" as the display and Client_ID as the value from the dropdown list.
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]....
I have a problem by getting session which created for new site visit or session expired.
View 3 RepliesI want the code for showing popup dialog box , to show the time remaining for session closing because of in-activity. and 2 buttons for allowing to stay or to signout.
i want all the settings that are need to achieve the functionality.
I have a class called EditMapUtilities. Here are some class properties that I want to persist:
public class EditMapUtlities
{
public static Boolean isInitialEditMapPageLoad
{
get { return SessionHandler.isInitialEditMapPageLoad; }
set { SessionHandler.isInitialEditMapPageLoad = value; }
}
// REST OF CLASS NOT GERMAIN TO DISCUSSION AND OMITTED
}
Here is my SessionHandler Class following the pattern from this post Static Session Class and Multiple Users:
using System.Web.SessionState;
public static class SessionHandler
{
private static HttpSessionState currentSession
{
get
{
if (HttpContext.Current.Session == null)
throw new Exception("Session is not available in the current context.");
else
return HttpContext.Current.Session;
}
}
//A boolean type session variable
private static string _isInitialEditMapPageLoad = "EditMapInitialPageLoad";
public static bool isInitialEditMapPageLoad
{
get
{
if (currentSession[_isInitialEditMapPageLoad] == null)
return true;
else
return (Boolean)currentSession[_isInitialEditMapPageLoad];
}
set
{
currentSession[_isInitialEditMapPageLoad] = value;
}
}
}
I am still learning OOAD. I want to keep relevant properties with relevant classes. I also want to keep all Session stored variables in one place for ease of maintenance and to encapsulate the session keys and calls. I feel like my design is too coupled though. How can I make it more loosely coupled? Is my editMapUtilities class too tightly coupled to the SessionHandler class? How would you do it better?
Let suppose, I am building an asp.net website which has login scenario in it. I want to provide a certain functionality to the website that if the user is already login on computer 1 and now try to login on computer 2, so he will be allowed to remain login on computer 2, while automatically logout him from computer 1. I also know that http is a stateless medium, so whenever user interact with computer 1 and try to interact with the page, it will get noticed at that time.
View 2 RepliesIs there room for issue in the following code in terms of multiple users of the same web application? I mean, I know that a purely static string will be shared across all sessions for a single ASP.NET application, but since this explicitly refers to the Current.Session, even though it is static it seems like it would always refer to the session instance of the "current user." But an error is happening that could be explained by everyone sharing the current value of Mode and thus the most recent change overwriting everyone else's mode value. (As a background: This string is in a Helpers class that is used throughout the application. I do not want to make references to Session["Mode"] throughout the application and do not want to have to pass Session["Mode"] in every method call from an aspx.cs page.)
public static string Mode
{
get
{
var value = HttpContext.Current.Session["Mode"];
return (value ?? string.Empty).ToString();
}
set
{
HttpContext.Current.Session["Mode"] = value;
}
}
I use some session variables to get the job done(shopping cart, etc) but it is not stable..manytimes I get no items in session object and other times(refreshing the page) I get missing data...I downloaded the entire site code to my local pc and debugged it and run it succesfully without any session data missing...When I run it in the server, I get bad session again: no products in shopping cart or products with missing quantities...
The same website runs smoothly in our production server too....The problem is with our development server...