session-variables

ASP.NET MVC Unit Testing - Sessions

ⅰ亾dé卋堺 提交于 2019-12-03 04:52:53
Having searched StackOverflow, and Google I think what I'm doing is suppose to be right, however results don't seem to be going well [TestMethod] public void LoginAction_Should_Return_View_and_User_Authenticated() { // Arrange var mock = new Mock<ControllerContext>(); var mockSession = new Mock<HttpSessionStateBase>(); mock.Setup(p => p.HttpContext.Session).Returns(mockSession.Object); var testData = FakeUserData.CreateTestUsers(); var repository = new FakeUserRepository(testData); var controller = new AccountController(repository); controller.ControllerContext = mock.Object; // Act var result

What are the benefits of a stateless web application?

假装没事ソ 提交于 2019-12-03 03:08:00
问题 It seems some web architects aim to have a stateless web application. Does that mean basically not storing user sessions? Or is there more to it? If it is just the user session storing, what is the benefit of not doing that? 回答1: Reduces memory usage . Imagine if google stored session information about every one of their users Easier to support server farms . If you need session data and you have more than 1 server, you need a way to sync that session data across servers. Normally this is

Shopping cart persistence: $_SESSION or browser cookie?

筅森魡賤 提交于 2019-12-03 01:04:30
问题 On an e-commerce site with no username/login to persist cart data, would it be better to use the PHP $_SESSION variable or a browser cookie to persist items in the shopping cart? I am leaning toward $_SESSION since cookies can be disabled, but would like to hear thoughts from you. Thank you in advance for your consideration. 回答1: Neither No large sites would dare store a user's cart in a session or cookie - that data is just to valuable. What customers are buying, when they select items, how

Safari and php sessions not working in facebook iframe

时光毁灭记忆、已成空白 提交于 2019-12-03 00:28:05
I'm having a problem to make my facebook app working on Safari. The issue is related to the PHP session variables. I am aware that Safari has a problem dealing with cross domain sessions (inside an iframe) and i found around 2 types of solutions: Setting the p3p header: i've tried many p3p header found around but no one of them worked [for example: header('P3P: CP="NOI ADM DEV COM NAV OUR STP"'); ]. Sending a post to the iframe, using javascript. This creates interaction and sessions should work. But the fact is that i do not control the iframe container, as that is facebook. Does anyone know

echo user in view from sessions code igniter

孤者浪人 提交于 2019-12-02 20:08:40
问题 I am new in codeigniter. I have implemented a simple login system. I want to print out a username on my view page which is stored in sessions. here is my controller class LoginController extends CI_Controller { function index(){ $new['main_content'] = 'loginView'; $this->load->view('loginTemplate/template', $new); } function verifyUser(){ //getting parameters from view $data = array( 'username' => $this->input->post('username'), 'password' => $this->input->post('password') ); $this->load-

Session variable still remains null between two different controllers

半腔热情 提交于 2019-12-02 19:49:18
问题 I have a problem with my MVC project! The goal is to set a session var in order to pass it to all the controllers: inside my xUserController, Session["UserId"] = 52; Session.Timeout = 30; string SessionUserId = ((Session != null) && (Session["UserId"] != null)) ? Session["UserId"].ToString() : ""; //SessionUserId ="52" But within the ChatMessageController [HttpPost] public ActionResult AddMessageToConference(int? id,ChatMessageModels _model){ var response = new NzilameetingResponse(); string

Shopping cart persistence: $_SESSION or browser cookie?

只愿长相守 提交于 2019-12-02 16:23:05
On an e-commerce site with no username/login to persist cart data, would it be better to use the PHP $_SESSION variable or a browser cookie to persist items in the shopping cart? I am leaning toward $_SESSION since cookies can be disabled, but would like to hear thoughts from you. Thank you in advance for your consideration. Neither No large sites would dare store a user's cart in a session or cookie - that data is just to valuable. What customers are buying, when they select items, how many they purchase, why they don't finish the checkout, etc.. are all very, very important to your business.

Passing PHP Variable From One Dynamic Page to Another

我只是一个虾纸丫 提交于 2019-12-02 15:37:26
问题 I am trying to pass on some variables using SESSION from one PHP page to the next. The first page contains this code and after the user clicks submit, it goes to Page 2: <!--SESSIONS TO PASS ON VARIABLES--> <?php $_SESSION['file'] = $file; ?> <?php $_SESSION['linecount'] = $linecount; ?> <?php $_SESSION['priceperpost'] = $priceperpost; ?> <?php $_SESSION['totalcost'] = $totalcost; ?> <!--//SESSIONS TO PASS ON VARIABLES--> And this is what I have on the next page, Page 2, after the form is

What are the benefits of a stateless web application?

北慕城南 提交于 2019-12-02 15:11:49
It seems some web architects aim to have a stateless web application. Does that mean basically not storing user sessions? Or is there more to it? If it is just the user session storing, what is the benefit of not doing that? tster Reduces memory usage . Imagine if google stored session information about every one of their users Easier to support server farms . If you need session data and you have more than 1 server, you need a way to sync that session data across servers. Normally this is done using a database. Reduce session expiration problems . Sometimes expiring sessions cause issues that

PHP Notice: Use of undefined constant [duplicate]

我与影子孤独终老i 提交于 2019-12-02 15:06:00
This question already has an answer here: What does the PHP error message “Notice: Use of undefined constant” mean? 9 answers I have a strange error message after using the post to wall function. It did successfully post to the wall however i got a very weird strange error. [Mon Dec 28 12:47:36 2015] [error] [client 5.29.224.120] PHP Notice: Use of undefined constant female - assumed 'female' in /datas/vhosts/nf.com/httpdocs/agence1948/result.php on line 178, referer: https://nf.com/agence1948/question.php [Mon Dec 28 12:47:36 2015] [error] [client 5.29.224.120] PHP Notice: Use of undefined