session-variables

Spring 3.0 set and get session attribute

风格不统一 提交于 2019-11-26 23:58:59
问题 I want to read a domain object (UserVO) from session scope. I am setting the UserVO in a controller called WelcomeController @Controller @RequestMapping("/welcome.htm") public class WelcomeController { @RequestMapping(method = RequestMethod.POST) public String processSubmit(BindingResult result, SessionStatus status,HttpSession session){ User user = loginService.loginUser(loginCredentials); session.setAttribute("user", user); return "loginSuccess"; } } I am able to use the object in jsp pages

How to configure a session timeout for Grails application?

房东的猫 提交于 2019-11-26 22:35:30
问题 In one of controllers in my Grails application I'm preserving a parameter value in a session variable like this: session.myVariable = params.myValue After that, I can access the saved value from different controllers/GSP-pages as long as I actively use the app. However, if I don't use my app for a while, even though my browser window is still open, the session variable looses it's value. Does this happens because the session expires? I was under impression that a session lives until the

mvc 5 session timeout after default period (20 mins)

不羁岁月 提交于 2019-11-26 20:23:24
问题 My MVC 5 site has web.config like this: <authentication mode="Forms"> <forms name=".ADAuthCookie" loginUrl="~/Account/Login" timeout="2880" slidingExpiration="true" protection="All" /> </authentication> but timeout doesn't work. It doesn't matter what value I give here, it always expires after 20-30 mins. How can I maintain users logged in for longer period or until they sign-out? Is there any way I can achieve this using "In-Proc" only? Or I am missing something here? 回答1: You are dealing

Are there limits for session variables?

亡梦爱人 提交于 2019-11-26 20:13:35
As the title says, are there limits (if any) for session variables or they're considered as usual variables and can store equal amount of data? I'm looking if there are any other limits aside from variable type ones like max length, max values and so on. P.S. If the question is unclear, please let me know. Thanks in advance! Piskvor As @Thariama said, there's no limit on the number of variables; also, there's no limit on the amount of data you can store in a session (I've seen sessions tens of MB in size). As the size of a session gets larger, you'll run into various quirks though: PHP 5

What is the right time for ViewData, ViewBag, Session, TempData

六月ゝ 毕业季﹏ 提交于 2019-11-26 19:42:41
I was editing a project and I saw a Session[""] in one controller method and TempData[""] in another. Is there a difference between the 4 or is it just 4 ways to do the same thing. Darin Dimitrov ViewData/ViewBag - valid only for the duration of the current request. You set it in a controller action and use it in the view, then it disappears. The difference is that the first is a dictionary whereas the second is just a dynamic wrapper around this dictionary. Both point to the same data though. ViewBag was introduced in ASP.NET MVC 3. Example: public ActionResult Index() { ViewData["foo"] =

PHP session variables not preserved with ajax

こ雲淡風輕ζ 提交于 2019-11-26 18:28:43
问题 I have a one page website that uses AJAX to load new php files and update the display. I start my php session on the main page but when I use ajax to update inner html I need those session variables for the new php file being loaded. This post is similar to this one: PHP Session Variables Not Preserved . But I checked and my php.ini has session.use_cookies = 1 Main Page PHP: <?php session_start(); if(isset($_SESSION['views'])) {$_SESSION['views']=$_SESSION['views']+1;} else {$_SESSION['views'

PHP session seemingly not working

冷暖自知 提交于 2019-11-26 17:51:30
问题 Session variables are apparently not working for me. I don't know what I'm doing wrong. This is the code that I'm using to check for a valid password: if ($input_password_hash == $password_hash) { session_start(); $_SESSION['is_user'] = 1; header("Location: ../new_look"); //or Location: index.php } else echo "Wrong password."; in the index.php file (where it redirects to), I have this code: if ($_SESSION['is_user'] == 1) { //show index page with navigation bar for registered user } else { /

What is the maximum size a session variable can hold?

柔情痞子 提交于 2019-11-26 16:56:13
问题 What is the maximum size a session variable can hold ? I am trying to store object in session variable, if object size is under 80 KB, then working fine and if the size is greater than 80 KB then on retrieval I am getting an exception. How can I increase the session variable size? This behaviour is on my production server, on the development machine I can store big objects like above 500 KB etc.. I am implementing something like... http://aspalliance.com/1221_CodeSnip_Uploading_Multiple_Files

Web authentication state - Session vs Cookie?

半世苍凉 提交于 2019-11-26 15:46:25
问题 What's the best way to authenticate and track user authentication state from page to page? Some say session state, some say cookies? Could I just use a session variable that has the ID of the user and upon authentication, instatiate a custom User class that has the User's information. Then, on every page, verify the session variable is still active and access basic user data from the User object? Any thoughts? Any good examples? 回答1: There's no perfect way to do it. If you store it in a

Magento - Passing data between a controller and a block

你说的曾经没有我的故事 提交于 2019-11-26 15:15:59
问题 Really quick and simple question but I can't find a decent answer to this - What is the best way to pass data from a controller to a block in Magento. Incase it makes a difference, I am loading the layout as follows: $this->loadLayout(array('default', 'myModule_default')); $this->_initLayoutMessages('customer/session') ->_initLayoutMessages('catalog/session') ->renderLayout(); I should add, that I have been using the registry as follows: In the controller: Mage::register('data', $data); In