Dear All, I want to ask about session. Is it possible to create session from JavaScript? How ?
Thx, for ur response
Dear All, I want to ask about session. Is it possible to create session from JavaScript? How ?
Thx, for ur response
No
Javascript works on client side and you won't be able to set or destroy session which is created on server from javascript.
With the help of a server side language like C# you can achieve this.
So, technically no. Sessions are server side and javascript runs on the client.
But, you can have your javascript send a request to the server that initiates a session. You'd still need some coding on the server, though (PHP, Java, etc.). Ex., it's fairly common practice to initiate a new session for a user when they log in (of note, they'll often already have a session, so you're really re-initializing).
to set the value of session you can user page method because it is not possible in js.
I agree of course with others here. Although technically, you can control the client-side portion of the session state with javascript because javascript has control over the cookies where the client-side session information is stored. You cannot initiate a session with javascript, that has to be done by the server. But if the server uses some client-side state to determine if the next request will result in the creation of a session, you have control with javascript. For instance, perhaps setting a session id cookie and then talking to the server will cause it to create a session with that id for you. Depends on the server. A decent server should not do that. Also, once you have a session through whatever means, you can modify the client-side portion of session data if it is present and you know how to read it. However, a proper implementation of sessions just has a session id in a cookie on the client-side. If that's all the server in question uses, not much to edit there.
Ok, Thx for the responses.
I Use PageMethod from Javascript to access c# method. C# method in static form. [WebMethod] public static void getHTMLTableValue() { // here I want to call My Dynamic HTMLTable Control(ex:tblA) // but i cannot fount tblA Control, how can I get my tblA ? }