C# - Keep A Session Variable When The User Is Logged In?
May 7, 2009
I keep a Session variable when the user is logged in. So that when the user click on btnLogout it must clear all my sessions and Log the User out for GOOD!!!
It does clear my sessions but if i click the BACK button in IE right after i logged out then i am still logged in! Meaning it goes back to screen where the user was still logged into.
I am trying to compare a session variable to another string so that i can enable or disable image buttons. I am using asp.net vb with a sql2005 express backend..[code]
I am trying to compare a session variable to another string so that i can enable or disable image buttons.I am using asp.net vb with a sql2005 express backend
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
I'm running an application under an account that is not the account logged-on to the PC.
Within the application I need check if the logged-on user is a member of the Administrators group. Below is the code I'm using. From what I've read, WindowsIdentity.GetCurrent() should return an object associated with the logged-on user. It doesn't, it returns the same information as the call to System.Threading.Thread.CurrentPrincipal. Which is the information associated to the ID running the application, not the logged-on user.
I am using Microsoft visual basic 2010 for a asp.net site using c#.I am using the asp.net configuration for user registration. I have a comments form which I want to appear only if a user is logged in.I now there is a toolbox helper thing called Login View which does exactly what I want but as soon as I put a form inside the code won't compile because it cannot find the textbox fields.
If I take the form out of asp:LoginView it works fine. Inside I get the following:
Error 2 The name 'txtTitle' does not exist in the current context NewsArticle.aspx.cs 59 53 Figmentville Error 3 The name 'txtComment' does not exist in the current context NewsArticle.aspx.cs 59 68 Figmentville
The logged-in 'UserId' and 'UserName' is getting displayed correctly, but now how do I use the string 'lmember' in my 'SELECT' statement when I need to display the related information from the table 'aspnet_Users' for the logged-in user? getting the following select statement:
SelectCommand="SELECT * FROM aspnet_Users WHERE (UserName= ????)"
I'm writing software in VB .NET (2005) which uses the Windows user information as login credentials - just the username. I've found Environment.UserName which works for the username (as you would expect).However, I need more information - I need the full name of the user (as shown on the Start Menu). It seems this information is stored... somewhere, as Windows is able to use it for things like permissions on file shares.
i have a problem with my project.in one form i have 2 textboxes in one i have displayed the serial number.in the second i want display the current user logged on software.how can i display the current user logged in ????? the code for the serial number is :[code].....
I need to create a spreadsheet of which kit is assigned to which person, within the company.
We have desktops & laptops, for the purpose of this post, we'll say desktops are named DESKTOP then a random 3 digit number (DESKTOP001, DESKTOP002 etc.) and laptops are named LAPTOP then a random 3 digit number (LAPTOP001, LAPTOP002 etc.)
I'm presuming the best way of checking which user uses each workstation would be to check who last logged in to it. doing this for ALL computers in a certain OU (lets say DESKTOP_OU for desktops and LAPTOP_OU for laptops in this example) (either with VB Script or PowerShell I would presume) and to export it to Excel.
what i want is when the user inputs the username and password, his/her information will be showed in the textbox located at the mainform which shows the users information like where he live and his occupation. how to show users data in the textbox of another form when he/she logged in. im using vb.net and mssql
I have a windows login form, and it checks whether the user name and password match and lets you log in. If I wanted to say pull some information from a dataset later on in the program. How would i pull the data from the specific user that is logged in, rather than all the data from the database.
I have a client/server application running in a windows domain environment, the client application is started at log on by a scheduled task using domain admin credentials, i need to be able retrieve the username of the user who logged onto the workstation but all the methods i have tried returns the user that was used to execute the program.I have tried:
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles start.Click Dim folderExists As Boolean
[Code]....
above i have a specific username in the little backup script i have created. in this section of the code, if the user selects this particular chkbox then hits "start" it backs up the above loacation to a "server" H.
how do i code it to automatically pull the username and place it where "godboubs" (aka the username) is?
Partial Class Preferences_MyPreferences Inherits System.Web.UI.Page Dim userID As String = Session("UserID")
This is just a page in asp.net. I want to be able to grab the Session("UserID") but every time I try, I get this 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 \ section in the application configuration.
If I put that Dim userID inside say the Page_Load Event, then it works fine. Why does it have to be inside an event? I want to dim it once, and use it throughout the page.
I have an aspx page with a button, the user clicks the button a session variable gets set, I then read the session variable later. here is an exaple of my button:
I programmed my website using visual basic code (via microsoft expression web) and need to post information to a remote location using a php page. How do I take variables from my visual basic code and transfer them to my php code? I was thinking sessions would work, but I haven't figured it out yet.
I have this code that gives me the user logged on name of a remote computer, but if i run the program in certaing computers, it returns with the error "Not Available Due Restrictions" which is set if the scope cant connect...
why it connects fine in some computers and other not..is there something i have to add to the code for it to run fine in any computer
this is the code
vb.net Dim connection As New ConnectionOptions connection.Username = ("ADMIN") connection.Password = ("something")
For some reason the following code works perfectly fine if a user is logged into a machine but if no one is logged in, I receive the error message "Call was canceled by the message filter. (Exception from HRESULT: 0x80010002 (RPC_E_CALL_CANCELED))" I know it is possible somehow to create the service on the remote machine even if a user is not logged in but what must I change in my code??
My vb.net application needs to use a session variable. I don't really know how to use it in ASP.net. I've been trying to use what my books have, but I can't get this label to work. I need the user input to be validated against the database and if their code is in the database, the textbox should disappear and a label will appear saying Welcome. The way I wrote it, I get an error saying the server tag is not well formed and in the codebehind it says that the ID of my label is not declared. Can anyone spot any problems with the code I wrote?
I am using ASP.NET. It is possible to create a session variable on page load just for a particular page/url? The problem that I have is: The user comes to page 1 and the session variable becomes A, then he opens page 2 in a new tab and the session variable because B on both page 1 and page 2. So when the user needs the session variable on page 1 it does not work because the variable have changed!
I'm using a compiled .dll provided by someone else -- I know little about it, other than it has a session variable that I must access in a way that is strange to me. Not sure what to call it -- have googled for words that I thought might be right, but so far no success.
I am using VB in VS 2008. I have written a program which loads data into SQL Server nightly. It is a Windows Forms application which runs well from Task Scheduler when a user is logged in. However when I try to run it when there is no user logged in, the program starts but it just sits idle.
I have an intranet asp.net application and when a page is loaded, i want to log the IP Address, Computer Name and the Windows Account(from active directory) currently logged into the computer from which the page is being accessed.
So far, Im able to get the IP address and computer name but the windows account, am getting NT AUTHORITYSYSTEM
Is there a way to include a person's logged in user name in an insert statement? Like, how could I detect which user is signed in, and then insert that username into my table in my database?