w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
persistent connection id state through out a browser session using signalR
The most common way would be to maintain a static List<CustomType> in your hub where the CustomType has properties UserId and ConnectionId Here is an implmentation you can follow too: http://www.tugberkugurlu.com/archive/mapping-asp-net-signalr-connections-to-real-application-users I write my connectionIds to a sql database in the SignalR.OnConnected event and delete them in the SignalR.OnDisconnected event, you will get some orphaned connections records in your table which is no big deal just made sure you have a created_date column and ignore any connections that are so many hours or days old depending on your needs. Also there is no Session in SignalR, don't even try it, it is a known issue. To get your current user, modern out of the box Microsoft MVC membership providers work

Categories : Misc

Setting session in Zend Registry Or Create each time new instance of session?
Zend_Registry is used to store objects/values for the current request. In short, anything that you commit to Registry in index.php can be accessed from other controllers/actions (because EVERY request is first routed to the index.php bootstrapper via the .htaccess file). Config parameters and db parameters are generally prepped for global use using the Zend_Registry object. Zend_Session_Namespace actually uses PHP sessions. Data stored using Zend_Session can be accessed in different/all pages. So, if you want to create a variable named ‘UserRole’ in the /auth/login script and want it to be accessible in /auth/redirect, you would use Zend_Session. For Example if you have a DB object stored in the registry, and when you are access a page say login page, this particular DB object will

Categories : PHP

how to start a session by adding a link and end the session in the same way and showing session datas
Here is how you can end the session with a link, by passing a $_GET parameter <a href="?logout"> Log out </a> <?php if(isset($_GET['logout'])) { session_destroy(); } ?> It is worthy to note, that you must have already started the session with session_start() before destroying it.

Categories : PHP

Sturts 2 session invalidation with setting request session to a new session
If you want to access the struts session after you invalidated the servlet session you should update or renew the struts session. For example SessionMap session = (SessionMap) ActionContext.getContext().getSession(); //invalidate session.invalidate(); //renew servlet session session.put("renewServletSession", null); session.remove("renewServletSession"); //populate the struts session session.entrySet(); now struts session is ready to use the new servlet session and you ready to reuse the struts session.

Categories : Java

How to create .log file for each session and how to store that particular session data in .log file?
I don't know if you can do this directly with log4j, or any of the logging frameworks, but it sounds like what you need is an "audit" log. The way we handled it was to create a custom annotation, @Audit, that we could apply to a method that needed to be audited. In our case, we didn't write to a log file, but rather stored the audit record into a DB table. You could easily setup your own annotation that used Log4J with a custom appender that wrote lines to a particular logfile. Such a annotation might look like: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Audit { // Put any custom parameters here for your annotation } And then you need some way to "read" those annotations later. We chose to use AOP like such: @Aspect @Component("auditAdvice"

Categories : Hibernate

ASP.NET Session-State InProc
The <ConnectionStrings> section shown above the <SessionState> section is in NO way connected to sessionState. The ConnectionStrings section is for other purposes like when you have your own Database and you need to connect to it as well as this section only contains the details of database used for MemberShip, Profiles etc. The <sessionState > element has its own settings for specifying the connections string named: sqlConnectionString as seen below: <sessionState mode="Off|InProc|StateServer|SQLServer" cookieless="true|false" timeout="number of minutes" stateConnectionString="tcpip=server:port" sqlConnectionString="sql connection string" stateNetworkTimeout="number of seconds"/> Now when

Categories : Asp Net

Session state CLOSED_LOGIN_FAILED
OK MY SONS! LISTEN TO THIS SOLUTION AND BE SAVED go to this solution and folow carefully: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1 now pay close attention: you must do it with java 1.6!! in my case i did it twice like he suggested on my original keystore file as well-not sure if this is essential. last but not least: go to the android developer site and press Status and Reviews make your app public and open champein! (i really hate face)

Categories : Android

Asp.net,Session state issues with the following scenario
The code that you showed in the comments is completely different from the code in the question. The code in the question uses a value type, so assigning the value from the variable to the session variable will copy the value. Assigning another value to the variable will not affect the value that was copied to the session variable. The code in the comments uses a reference type, so assigning the value from the variable to the session variable will copy the reference. That means that both the variable and the session variable are pointing to the same instance of the object. Also, the code in the comment changes a member of the object, it doesn't assign a new value to the variable. When you change the member of the object that the variable is pointing to, it will change the object that the

Categories : Asp Net

Dynamic session state provider
You can use Web Config Transformations to achieve this. This will allow you to specify transform sections in your web.config and have seperate files for different environments that replace the transform tokens during build. More info here: http://msdn.microsoft.com/en-us/library/dd465318%28v=vs.100%29.aspx When you deploy a Web site, you often want some settings in the deployed application's Web.config file to be different from the development Web.config file. For example, you might want to disable debug options and change connection strings so that they point to different databases. This topic explains how to set up a Web.config transform file that is applied automatically during deployment in order to make changes to the deployed versions of Web.config files. Web.c

Categories : C#

How to handle ASP.NET Session State in AppHarbor
You should just use MemCachier for EU apps. The AppHarbor support forums have details on how to get MemCachier set up for use with session state.

Categories : Asp Net

asp.net session state from non browser requests
If I understand correctly, the console application would be sending a HTTP POST to a web server. If that's the case, your console application is acting like a web browser, and Session is initialized. But ASP.NET normally sends the Session ID using a Cookie, so the browser (or console application) has to store that cookie to continue the session in a future HTTP request to that same HTTP server.

Categories : C#

Facebook session state OPENING
Try calling publishFeedDialog() from inside call() after you check for the status of the session (do not use session.isOpened(), use state.isOpened() instead). Checking the state ensures that your Session is in an open state and that it can also be used to execute requests. The StatusCallback can be called multiple times until the Session is actually open, that is why you should check the status before sending any request.

Categories : Android

how to generate unique session Id without the use of session_id()?
use a function like function createRandomVal($val){ $chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,-"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i<=$val) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } and pass return value in session id

Categories : PHP

how to generate unique session id onload?
Just because your site doesn't have a login system doesn't mean you still cannot use sessions. A solution for you may be to use jQuery to listen for all click events, then push values onto a value... Then a timer, such as setInterval, to call an AJAX function and send up the json-encoded data to the server... from there, parse and log the data.

Categories : PHP

AppFabric 1.1 for session state cache on a .net 2.0 application
AppFabric Session State Provider 1.1 (Microsoft.Web.DistributedCache.dll) requires .net 4 and adds many new features. You can see how to configure it here but there is no way to use it as a state provider for a .net 2.0 web site. Hopefully, AppFabric Session State Provider 1.0 (Microsoft.ApplicationServer.Caching.Client.dll) is compatible with AppFabric 1.1. You just have to be carefull on the web.config because the configuration section is not the same. Here is a very basic web.config : <?xml version="1.0" encoding="utf-8" ?> <configuration> <!--configSections must be the FIRST element --> <configSections> <!-- required to read the <dataCacheClient> element --> <section name="dataCacheClient" type="Microsoft.Application

Categories : Misc

ASP.NET injects session state into the URL despite the "UseCookies" setting
Turns out there're two completely separate settings - one from system.web/sessionState and the other one from system.web/authentication/forms/cookieless and they have different values by default. The latter has UseDeviceProfile by default and so it will sometimes inject the Forms authentication token into the URL. In our case this configuration made no sense - if the user has no cookies support he can't use our site because it relies on cookies heavily, so we just changes system.web/authentication/forms/cookieless to UseCookies.

Categories : Dotnet

How to get around storing a usercontrol out of process in session state
nThe end result was that the myDatesContorl class, inheriting from usercontrol class, could not be serialized to session state. I created a "accompanying" class and duplicated the properties of the UC. In my code, I then use the accompanying class to store state about the control, and create the controls only before display, re-reassign their properties.

Categories : C#

Make MVC Sitemap unique per session, not user
Option 1: Implement your own ICacheProvider based on session state and inject it using DI. using System; using System.Collections.Generic; using MvcSiteMapProvider.Web.Mvc; using MvcSiteMapProvider.Caching; using System.Web; public class SessionStateCacheProvider<T> : ICacheProvider<T> { public SessionStateCacheProvider( IMvcContextFactory mvcContextFactory ) { if (mvcContextFactory == null) throw new ArgumentNullException("mvcContextFactory"); this.mvcContextFactory = mvcContextFactory; } private readonly IMvcContextFactory mvcContextFactory; protected HttpContextBase Context { get { return this.mvcContextFactory.CreateHttpContext(); } } #region ICacheProvid

Categories : Asp Net Mvc

Session service unique id initialization with Autofac
The problem is caused by your properties in the PushNotificationListener class. Since you create new lifetime scopes in their, within that scope a new SessionService will be created. Prevent doing this. Instead, there should only be one lifetime scope for each session. You should create a new lifetime scope (and only one lifetime scope) directly after the event is raised and before you resolve the root object. From that point on, all dependencies should be injected using constructor injection. This ensures that within that scope, there is only one SessionService.

Categories : C#

How to upload images to a new unique folder every session php
I just did something similar for my uncle's company. To solve your issue of not knowing a good way to have the person submit there info you can create a form that takes info and then sends an email to your dad's work email. Here's an example of the php mail function. $to = 'service@anywhere.com'; $subject = 'New Service Request:'; $time = date('l jS of F Y h:i:s A'); $body = "New Service Request Submited - $time (time is coming from webserver) First Name: ".$_POST['fname']." Last Name: ".$_POST['lname']." Title: ".$_POST['title']." Business: ".$_POST['business']." Phone: ".$_POST['phone']." Email: ".$_POST['email']." Address: ".$_POST['address']." Preferred Method of Contact: ".$method." Equipment Type: ".$_POST['type']." Equipment Issue: ".$_POST['issue']." Additional Comments

Categories : PHP

Facebook SDK 3.0 freezes on session state OPENING in Android
Dont forget to add onActivityResult method @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); }

Categories : Android

Asp.net azure co located cache session state settings?
All machines have access to the same session state regardless of the "high availability" checkbox. High-availability checkbox ensures that cache data is not accidentally lost and replicates that data to other servers in the cluster (2nd copy only) - however, even if that wasn't the case, all of your servers have access to cache across all servers. HA option is helpful only in case of an outage where one of the cache servers were to go down or get auto-scaled down. In such cases, lack of this checkbox can cause issues HTH

Categories : Asp Net

manage azure session state data across multiple VMs
You have a number of options: 1) Use Azure Shared Cache - this is the original Cache-as-a-Service from Azure and works decently well unless you get to super-high scale scenarios 2) Use SQL Server-based session - this should work against your own SQL database running in IAAS VM or against SQL Azure 3) Create your own table storage or blob storage session provider. There has been an attempt of making on here but it's been long abandoned as far as I know.

Categories : Azure

Ensuring unique serial numbers in a Hibernate session
You can use a MultipleHiLoPerTableGenerator: it generate @Id outside current transaction.

Categories : Java

'in-proc' Session State mode on a multiple server setup?
When using InProc session state, the session will be stored locally on the server which served the request and therefore using the same Machine Key on both servers won't serve the purpose. This option is not fit for use in a web farm environment. One farm machine stores the session state but not the other. Subsequent web requests from the same user may not read the correct session state. Consider a very common scenario: Imagine that the web request is routed to farm machine A and the code invoked by the request relies on some parameters stored in the session. If the same user is then routed to machine B in the next web request which also relies on the session state then the results will be unpredictable. There is something called StickySessions which can tackle above scenario. But

Categories : Asp Net

(Servlets, Thread safety) Protecting the session and context state
And why are class (static) variables not thread-safe? Because all threads can access and modify (corrupt) that value? Correct. If a member is static, one thread can set a value and another thread can set differently. As static is shared variable, the value set by first thread will be the same for another thread also. Q. "The effect of implementing SingleThreadModel is virtually the same as synchronizing the service method. Both can bring a web app to its knees without protecting the session and context state." Even if you make some servlet implement SingleThreadModel, it will stop only those thread to executly simultaneoulsy which are trying to access that servlet. It can't stop all other servlets which do not implement SingleThreadModel from accessing context and session

Categories : Java

Error in Using Azure Shared Caching Session State Provider
Got it, was using http:// in host name. <host name="https://dummyPart-cache.accesscontrol.windows.net" cachePort="22243" /> it should be <host name="dummyPart-cache.accesscontrol.windows.net" cachePort="22243" />

Categories : Asp Net

Could not synchronize database state with session Error in Grails Hibernate
withTransaction provides access to the underlying transaction. If needed a control over transaction rollback you can use it. withSession uses the default session provided by SessionFactory. If needed a control over sesion then use it. Looking at your example, I would vouch for withTransaction (the simplest one).

Categories : Spring

MySQL Session state provider crashes on expired sessions
Fixed it! I dug through the code for version 6.8.3. In the file SessionProvider.cs: By always using an INSERT query, the code is assuming that no row for the session key already exists in the database -- which works fine for when the session is created, but throws an exception if the session key gets re-used. I fixed it with some similar code already within the same file, and I'm no longer getting the exception. The modified code uses a REPLACE query instead of INSERT. I've attached my updated file and a patch on a corresponding bug on the MySQL site (my base version is 6.8.3). You can download the 6.8.3 source, and patch it. You'll also have to comment out the AssemblyKeyName attribute (for strong assembly name) in AssemblyInfo.cs if you compile it yourself. Hopefully the MySQL f

Categories : Asp Net

ASP.net State Server losing session in load balanced environment
I've been told it's not possible to persist session data in a multi-server environment unless you use a SQL Server instance to store it...I'm assuming you're familiar with it but here's a link for others who may not be: http://support.microsoft.com/kb/317604

Categories : Asp Net

Session replication in Tomcat - jdbc session persistence - custom or library implementation?
Take a look at this: http://www.intelligrape.com/blog/2010/07/21/tomcat-6-session-persistence-through-jdbcstore/. I'm trying to do the same thing as you, I found that this works. However, I experience a delay on the DB session insert. If you use that solution and found an answer to it let me know.

Categories : Java

One session design pattern for EJB JPA and GWT RequestFactory aka keeping JPA session between multiple method calls
In your web layer you have two calls to a stateless session bean, so this results in two transactions. There are three options Use a UserTransaction in your web layer code: final InitialContext ic = new InitialContext(); final UserTransaction ut = (UserTransaction) ic.lookup("UserTransaction"); ut.begin(); try { // find // set new value in entity // save ut.commit(); System.out.println("committed"); } catch (Exception ex) { ut.rollback(); System.out.println("rolled back"); } This way the client controls the transaction. If someone forgets to use a UserTransaction, this will result in multiple transactions. There is no need to change the EJB side. Add a method in the facade which calls both DAB methods on behalf of the client: public void findAnd

Categories : Java

check session registered in php, than jquery ajax to print session variables
you can just create a php script that gets the session variable you need and echo it if its not empty (your logic). then you want to use that jquery script to update the div: function loadLog(){ $.ajax({ url: "getsession.php", cache: false, success: function(html){ $(".message").html(html); }});}

Categories : PHP

Hibernate's session.currentSession() with @Transactional errors while session.openSession() doesn't
By having a quick look at your code you open the session inside an if statement and base on some conditions. When you use the annotation it opens the session before the if statements and regardless of the conditions. That could be the reason behind the different behaviours.

Categories : Spring

session has already been started by session.auto-start or session_start() in Zend project
I'm guessing this is on a debian server? If not, this may not be the solution... but we ran into this on our Ubuntu based installations. This is happening because of the combination of the installed PHP package and the cron scripts that are running to take care of the session cleanup. (for whatever reason... not sure why they're doing that...) We were successful by doing the following things: - removing the cron job to clear out the PHP session stuff (trust me, its there - its annoying) - chmod www-data:www-data /var/lib/php5 (or equivalent info) - session.gc_probability = 1 in your php.ini file May not be the best solution, but it took care of it for me.

Categories : PHP

Delphi6: Need to know is my application running in console session or remote desktop session
I use the following const SM_REMOTESESSION = $1000; if GetSystemMetrics(SM_REMOTESESSION) <> 0 then begin // you are in a remote session end Per the MSDN page for GetSystemMetrics: SM_REMOTESESSION = 0x1000 This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session, the return value is 0. Windows Server 2003 and Windows XP: The console session is not necessarily the physical console. For more information, see WTSGetActiveConsoleSessionId. I am using this in Delphi 2007 and the function is defined in the Windows unit, but I did need to define the constant myself. I don't know if Delph

Categories : Delphi

Both HttpContextBase.Session and HttpContext.Current.Session are null on IRouteConstraint MVC4
Normally you should have access to the session. But in an ASP.NET MVC application avoid using the HttpContext.Current static property. Use the HttpContextBase abstraction provided to you instead: public class AdminRootConstraint : IRouteConstraint { public bool Match ( HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection ) { if ((string) values["controller"] == "Login") { return true; } object isAuthorized = httpContext.Session["IsAuthorized"]; return (isAuthorized != null && (bool)isAuthorized); } } In this example httpContext.Session won't be null. What could be null is httpContext.Session["IsAuth

Categories : C#

Difference in cookie content using Sinatra session & Rack::Session::EncryptedCookie
Because Rack::Session::EncryptedCookie requires that your secret be at least 16 bits long. In the README, they recommend using OpenSSL for generating the secret, like so: ruby -ropenssl -e "puts OpenSSL::Random.random_bytes(16).inspect" If you open your inspector, you'll see a cookie named 'rack.session', and its contents obfuscated.

Categories : Ruby

How to open a bash/ssh session in shell script and run commands in the remote session?
Take a look into expect, which "talks" to interactive programs with the help of a user provided script. Usage expect ./interact or making interact executable (chmod a+x interact): ./interact where interact is the following script: #!/usr/bin/expect spawn ./a.out send -- "yes " expect "3292 " send -- "no " This is just a simple example, the man page is full of in depth explanations and there are also example scripts which come with the installation. References http://linuxaria.com/howto/2-practical-examples-of-expect-on-the-linux-cli?lang=en Best way to interact with a service for exploitation purpose

Categories : Linux

While using session based model , getting error "undefined local variable or method session for " in rails
If I understand correctly, you've refactored the commented out code into the user_session object. If you read the error message you see that the error references a variable session for #<UserSession:0xXXXXX>. From this I understand that you tried to reference the session object from within the UserSession class, but you did not pass it to the user_session object. You should add it to the method's signature, and use it like this: class UserSession def add_comment(session, comment) session[:comment_ids] ||= [] session[:comment_ids] << comment.id end end And in your controller: if @comment.save user_session.add_comment(session, @comment) flash[:notice] = "Comment Successfully created" redirect_to @post else redirect_to :back end

Categories : Ruby On Rails



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.