473,698 Members | 2,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how Server judge an Ajax Request belongs to a Session

24 New Member
When user is authenticated, the server store "UserName" in session. Then throug ajax, the user request another page which require authentication. How the ajax request tell the server that one has been authenticated, or how the server know it's from 'UserName"?

Should ajax set SessionId in Header or Cookie ? How to get and set the SessionId ?

I learned the browser could send back to server a sessionid, but I don't know how this should be done in JS.

I'm using JQuery, C#.
Feb 21 '08 #1
3 2031
acoder
16,027 Recognized Expert Moderator MVP
Post some code that we can have a look at. Have you tried setting the session id without Ajax and got it all working fine?
Feb 21 '08 #2
rnd me
427 Recognized Expert Contributor
When user is authenticated, the server store "UserName" in session. Then throug ajax, the user request another page which require authentication. How the ajax request tell the server that one has been authenticated, or how the server know it's from 'UserName"?

Should ajax set SessionId in Header or Cookie ? How to get and set the SessionId ?

I learned the browser could send back to server a sessionid, but I don't know how this should be done in JS.

I'm using JQuery, C#.

my ajax code usually (in firefox at least) will automatically pop-up a login box if needed. the browser should handle this, it not something to worry about in js.

ajax will use the page's connection to the server.
when your page's connection times-out, so does the ajax auth.

does that help?
Feb 21 '08 #3
mentor
24 New Member
So I see that ajax will use the page's connection to the server. That's Ok, Thanks !


ajax will use the page's connection to the server.
when your page's connection times-out, so does the ajax auth.

does that help?
Mar 9 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
20071
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great with Firefox,but with IE6 the onFailure never gets called and the request never completes. My code: var ajaxReq = new Ajax.Request( url, {method: 'post', parameters:
2
6956
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
15
5948
by: Evil Otto | last post by:
My page loads, and calls an init() function that returns content to a div on the page, as well as setting a $_SESSION variable. The content it returns includes a link that calls the same variable, but I get an error that says the index isn't defined. The second two calls are AJAX-generated. The second call immediately echos the $_SESSION variable back after it sets it, and it sets it properly. But the subsequent request doesn't see...
7
3358
by: Tony Girgenti | last post by:
Hello. I'm trying to undetrstand ASP.NET 2.0 and javascript. When i have a button and i click on it and i see the web broswer progress bar at the bottom do something, does that mean that there is postback occurring? Does that mean a round trip to the server occurred? I keep reading javascript articles and tutorials that say "improve the client-side experience to be more responsive and quicker", but the articles
6
5156
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
16
2038
by: deostroll | last post by:
Suppose I have an asp page that has a response.write(something) in a loop that would run for a considerable amount of time. Now, from my client browser can I trap those server response messages (using ajax) and print them on the browser? (The thing is the asp page is still running over at the server...while it is running I would want to monitor some variables that is part of the program that is running over at the server) --deostroll
4
2050
by: KDawg44 | last post by:
Hi, I have a feeling this is a dumb question, but I am exploring AJAX and PHP. I would like to write my PHP in an Object Oriented approach. What is the limitation on what I can return in AJAX? Every example I find seems to be text, which make sense because it is client side. So, if I want to try to separate the presentation from the application, I should call a PHP script using AJAX, and in that PHP script have objects, call the...
7
4690
by: Anil | last post by:
I have a Javascript program which runs in the browser and has functions work(), and stop(). It listens to commands from the server to work() and can be interrupted by the server to stop(). I am using XmlHttpRequest to talk to the server. So I use http GET to send a command "ready" to the server, which replies at some point in time by sending "work" which is invoked by the callback. As per my understanding, the browser client is single...
0
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.