Passing variables vs session variable
what is the advantage of passing the variable in the url vs storing the variable in a session variable and retrieving it in the second webpage you are accessing?
The variable that you will pass using the QueryString will be visible to the user hence not secured. The value that you put in the Session is not available to the user as it is on the server side and hence more secured. HighOnCodingWanna get high!
performance wise does it matter?
Just my 2 cents...
I remember in college the professors would always harp upon using the Session responsibly. Most of the professors were old...How to get session variable value into a static variable
On page preinit i am adding few session variables.
Now i want to retrive these session variable values into my static variables.
protected void Page_PreInit(object sender, EventArgs e)
i have few static variables which shud contain these vaules.
public string TT;
public string TT1;
public string TextForeColor =sess = "#FFFFFF";
i want to get T value into TT ... T1 into TT1..and so on
&n...variable not a variable
Error:Must declare the variable '@cartDateTime'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@cartDateTime'.
Dim connStr As SqlConnection Dim cmdInsert As SqlCommand Dim strInsert As String &n...Variable Variables
Maybe the solution is very simple, but how do I create variable variables in vb.net? I want to use the value of a variable as a part of the name of another variable. A very simple example below:
Dim a As String
a = "1"
Label a.Text = "hi"
<asp:Label id="Label1" runat="server">Label</asp:Label>
In need this to change a range of values by using just one loop. I can´t do that without creating a variable variable name.
check out this little demo application I created for you:
How to make a variable receive an increment in the name?
I want to do it for example:
Label1->Caption = "1";
Label2->Caption = "2";
Label3->Caption = "3";
Label4->Caption = "4";
And I want to do something like that:
for (i=1; i<5; i++)
Label+i->Caption = i;
Any idea? Can I do something like that?
Thanks and regards
Create a vector of pointers to the various objects.
In your case below, construct a vector (called Labels) of pointers to TLable
long enough to hold pointers to...Complex Objects Stored in the Cache, as Application Variables, and as Session variables
I don't know why, but I had always thought that if I was dealing with a DataTable stored as a Session variable, that if retrieved it from the Session pool and made changes to it that I had to explicitly stored it back in the Session pool in order for those changes to be "permanent". I just discovered that this is not true. And it actually makes sense why I don't.But I'm curious, if instead I was using the Application variable pool or the cache, would it work the same way or would I, in fact, have to explicitly store the altered object back?Robert Robert...variable of variables
Say I have 2 scenarios and I want to use a different
variable depending on which scenario applies without coding
So I could have a database table t_variables which has:
In my Powerbuilder code I'd have values in v_name &
What I'd like to be able to do is to select which variable
to use from the table and assign that to something, e.g.
where scenario = 1
so at this point v_variable would be 'v_name'...Response.Redirect with Session Variable vs. Global Variable -- Best Practices?
Hi,I have a simple contact form and when the user presses the submit button an email is sent and I have a response.redirect to "emailSent.aspx" where it says "Your request has been received....etc.". I have the submit button in a try/catch block. What I want to do is a "emailFailed.aspx" where it says "Email problem, etc." but I also want to carry over the ex.message text. I want to pass the ex.error text to the "emailFailed.aspx" page so on pageLoad I can have a label with something like:labelMessage.Text = "There was a problem with your email. The error is " +...How to seperate a variable from the cached variable?
I have a cached List<T> object. I want to do something like: List<group> lGroups = Cache["lGroup"];---however, whenever I do an action against lGroups, it modifies the cache. How do I make it so whenever I modify lGroup is does not modify the cache.The Killer Ninja Coding Monkeys thank those that mark helpful posts as answers.My Site | My Examples | My Blog
Hi, create a copy of the list:List<group> lCachedGroups = (List<group>)Cache["lGroup"];List<group> lLocalGroups = new List<group>(lCachedGroups);Then do your modifications o...shared variable or session variable???
I've asked this question on a couple of different forums and usenet and noone has offered a reply, so I thought I'd try it here...
I have 2 different web apps that happen to do almost exactly the same things. One I did many months ago and the other is very recent. In both cases, I had data that needed to be available throughout all the functions of the page. Looking at the code, I noticed that in the older one I used a shared variable (woud be static in c#) to hold the needed data. In the newer app, I simply used a session variable. The data itself is a dataTable.
My question is:...Session variables vs. Session States
What is the difference and in what situations are they used.
A session state (the state of your session) holds your session variables. If your session state expires (due to inactivity) then you lose your session variables...and any other info stored for that session.
If you need to store USER specific information within a web app, then session variables are one(of several) ways to do it.
Is there any code that you could show that would give an example?
example of what? reading and writing session variables?
...Session Variables Vs Session Class
I am rewriting a classic ASP application in .NET using ASP.net and C#.
We used Session Variables to handle storing the current user information throughout the original application. I was wondering what the benefits would be of using a Session Class over Session Variables, and also how I could implement this?
Many thanks in advance for any information you can give me.
Check this out.
I think Session class always beneficial since you have more control over accessing and setting your session variables and exception handling. Check the link for its sample implem...Variables VS Session + Multiple Session Timeouts
I've read that "http is stateless" which is one reason people use Session variables instead of code behind variables.
I'm having problems with session variables vanishing after about 10mins.
I've checked "App Options" under "Application Configuration" under the properties of the Virtual Directory (IIS 5 on Win2000). It sais "Session Timeout = 59mins"
<forms timeout="60" />
<sessionState timeout="58" />
Im using master pages, and have declared public variable and session variab...global variable vs local variable
i have a scenario like function is called more than 1000 times.in that function i declared a varible and assigning a value .i felt like declare a global varible use it in that function and assign value.which is best.please tell me in performance point of view.
thanks in advance
Hai Good Morning you have call the function more than 1000 times Better use Global variables, so you can call the function, anywhere.. it has good performance.suppose it you want assign different values to the variables , whenever the function has been called for that use local ...