sessionid

Get Windows user name from SessionID

耗尽温柔 提交于 2019-11-28 09:27:26
Is there a method in C# to retrieve the user name from a given session id? (any session running on the system) The Win API function WTSQuerySessionInformation does this, but I'm searching for this funcationality in C#. joe There seems to be no .NET integrated method for this. So this is the current solution, using Windows Terminal services API: [DllImport("Wtsapi32.dll")] private static extern bool WTSQuerySessionInformation(IntPtr hServer, int sessionId, WtsInfoClass wtsInfoClass, out System.IntPtr ppBuffer, out int pBytesReturned); [DllImport("Wtsapi32.dll")] private static extern void

can a php $_SESSION variable have numeric id thus : $_SESSION['1234’]

天涯浪子 提交于 2019-11-28 08:56:09
问题 I've been driving myself nuts with this problem. I'm creating a session id dynamically in order to retain the page state on refresh. If a page element is clicked, I take the id of the element and pass it to my server side script which creates the session variable: $_SESSION[$id] = $id; Bizarrely, this was working only some of the time, I narrowed it down to the fact that some elements have a purely numeric id and others do not: if (is_numeric($id)) { $_SESSION[$id] = $id; $_SESSION['test'] =

How to maintain the same session id across multiple web applications in ASP.NET

六眼飞鱼酱① 提交于 2019-11-28 08:45:21
I have two identical applications setup on IIS on different virtual directories (I have done some workaround to ensure that they both have the same application name). Is there a way to share session id across two asp.net web applications? Since I'm storing the session in StateServer, they should both be getting the same session data, however, a different session id is created everytime I go from application a to applicatino b. Wouldn't this happen in a load balancing scenario as well? Where when I go to www.test.com, it would redirect that request to server a, and then if I hit it again, it

How to Generate a new Session ID

邮差的信 提交于 2019-11-28 05:25:28
Is it possible to generate a new ID for the session using ASP.NET? I want it to change when someone logs in to my website just before I set their initial session variables. You can do this using the SessionIdManager class: SessionIDManager manager = new SessionIDManager(); string newID = manager.CreateSessionID(Context); bool redirected = false; bool isAdded = false; manager.SaveSessionID(Context, newID, out redirected, out isAdded); [Code sample is from Anas Ghanem's article] you can use SessionIDManager.CreateSessionID Method : returns a unique session identifier that is a randomly generated

session_start() creates new session every refresh [duplicate]

不羁岁月 提交于 2019-11-28 01:58:58
This question already has an answer here: How to fix “Headers already sent” error in PHP 11 answers I am having an issue with session_start() . It is creating a new session every refresh/load of the page. here is the code: <?php $bob = session_id(); echo "Session ID on load is ".$bob; echo "<br>"; if($bob==""){ session_start(); $bob = session_id(); echo ' session ID currently is '.$bob; } // a bunch more stuff when i load the page, I get the following: Session ID on load is session ID is currently ed320bc5e24c871c9db8ea30e6796c14 (or a variant) if I refresh the page i get: Session ID on load

PHP: session isn't saving before header redirect

痞子三分冷 提交于 2019-11-28 00:54:31
I have read through the php manual for this problem and it seems quite a common issue but i have yet to find a solution. I am saving sessions in a database. My code is as follows: // session $_SESSION['userID'] = $user->id; header('Location: /subdirectory/index.php'); Then at the top of index.php after the session_start() , i have var_dumped the $_SESSION global and the userID is not in there. As i said ive looked through the PHP manual ( http://php.net/manual/en/function.session-write-close.php ) and neither session_write_close or session_regenerate_id(true) worked for me. Does anybody know a

linux command setsid

跟風遠走 提交于 2019-11-27 20:50:07
问题 I am trying to write a wrapper which will execute a script as a session leader. I am confused by the behaviour of the linux command setsid . Consider this script, called test.sh : #!/bin/bash SID=$(ps -p $$ --no-headers -o sid) if [ $# -ge 1 -a $$ -ne $SID ] ; then setsid bash test.sh echo pid=$$ ppid=$PPID sid=$SID parent else sleep 2 echo pid=$$ ppid=$PPID sid=$SID child sleep 2 fi The output differs depending on whether it is executed or sourced: $ bash $ SID=$(ps -p $$ --no-headers -o sid

What is the length of a PHP session id string?

懵懂的女人 提交于 2019-11-27 14:20:10
问题 I'm making a table in a MySQL database to save some session data, including session_id . What should be the length of the VARCHAR to store the session_id string? 回答1: Depends on session.hash_function and session.hash_bits_per_character. Check out the session_id page for more info. The higher you set session.hash_bits_per_character the shorter your session_id will become by using more bits per character. The possible values are 4, 5, or 6. When using sha-1 for hashing (by setting ini_set(

Reusing HttpURLConnection so as to keep session alive

泄露秘密 提交于 2019-11-27 12:42:29
问题 We have an Android application that requires the user to enter an answer to a Captcha. The Captcha is generated on our server. When the replies, it is sent to the server for verifying. Problem is that since I have to close the HttpURLConnection after the request for the Captcha I then find that the reply is running on a different session on the sever. Because of this the Captcha check fails since it is session dependant. Is there a way to keep the connection alive or should I be following a

ASP.NET Kill Session By Id

爷,独闯天下 提交于 2019-11-27 06:42:43
问题 My application has a control of User Permissions, because not all users can access full website. At this moment, all those permissions for an specific user are stored in his session, 'cause It would be a problem for me to search at Database every Post Back. The problem is that when I remove a permission, user can still access the page, and only when he closes the browser, the update take effect. Is there a way to Kill an specific Application Session by the ID, forcing user to Log in again?