first off I can't post the code, so I will do my best to try to explain what I am trying to do. I have a repeater with three literals (a member ID, a name, a uservalue) and three hyperlinks. Each of the hyperlinks goes to a different page (obviously).What I am trying to do is when the user clicks on one of the hyperlinks, (doesn't matter which one because the three literals need to be put into session variables regardless) I want the session variables set to the literal values before calling the next page.How do I get the session variables set when the user clicks on one of the hyperlinks?
I would like to run a SQL query on the codebehind VB page that will also set a value from that query to a Session variable. Also, this needs to be done on the Page_Load. Example: [Code]....
I'm building a site (it's amazing how much you can do and still not know what you're doing).I have my visitor login from a login.aspx page and, when authenticated are redirected to a Portal page. On that Portal page at pageload I set a Session variable "UserName" using the User.Identity.Name like this:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If User.Identity.Name <> "" And User.Identity.IsAuthenticated = True Then If Page.IsPostBack = False Then Session("UserName") = User.Identity.Name End If [code]...
I'm getting a very peculiar problem with my asp.net application, it took me an age to track down but I still don't know what is causing this behaviour.
If I set a session variable in the Application_PreRequestHandlerExecute event, then my external JavaScript files are ignored, and therfore causing a raft of errors. I have simplified the problem below.
E.g.
I have file called JScript.js containing the code:
function myAlert() { alert("Hi World"); }
And in my Default.aspx file I reference the js with the code:
And in the body onload event I call the myAlert() function:
<body onload="myAlert()">
And finally in the Global.asax file:
Private Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs) HttpContext.Current.Session("myVar") = "MyValue" End Sub
If you run the Default.aspx file you will see the js function isnt called, however, if you comment out the line of code Global.asax then the external js is called and the function executed when the page loads.
I've adde a WebUserControl inside Repeater control. My WebUserControl consists of basically three controls: a CheckBox, a HyperLink, and some Label control. Plz have a look:
[Code]....
I've some Buttons outside the Repeater control. Now I want to select individual row through CheckBox and process it on Button (outside Repeater) Click.
I have this button click event under which I have assigned session values. I am using this to pass variable to the user control which is utilised in that page. the issue being the session variable is not getting over written on one click. it is like I have to click twice to get the value up and running.
i'm using a repeater with an hyperlink and i'm displaying some data from a table x and when the link is clicked i want to add some from the displayed data in another table y..I used a datasource for selecting information , should i use another datasource for the insert command or what to do ..
Currently in an .aspx file, I am storing a value (filename that was created in that session) in an hidden text box. When the user clicks on the "Print" labeled Hyperlink control, it opens the file that was stored in the hidden text box control. But when the user goes to different screen (in the same session), I loose the filename value that is stored in the hidden text box control. So I would like to store the filename variable in a session variable. So that if the user leaves this .aspx file and comes back to this .aspx file I can load the value into the hidden text box from the session variable.
How would I create a list then on click add data to the list which is then stored into a session variable, then on another page retrieve the variable and output them? Currently I have:
Page Load:
List <myClass> listName=new List<myClass>
OnClick:
listName.add(3); listName.add(4);
Session["IDs"]=listName; Second Page
I need to get the whole list and add output the list so I can output (hopefully) the '3' and '4'.
I am using a repater whose item template is having a dropdownlist. Now i want to access that dropdownlist from a button click event. Here is the code iam using :
I have a web application which uses a session variable to store the logged in userid. If no user is logged in, of course this variable will be empty and the contents displayed on my website are meant for guests. If there is a user logged in, the user specific controls/access/links will then be a displayed.
I am now having issues with my hosting where on shared application pool, the worker recycle is triggered every 90 minutes, this will clear sessions causing all my users to be logged out. I opted for a dedicated application pool, which got worse because I am only allocated 50MB memory limit and if this is reached, the worker recycle is triggered and I lose my sessions again. I have tried as much as possible optimization techniques, e.g. dispose where possible, close connections, disable viewstate for static controls etc but my memory per instance keeps building up from page to page without any signs of improvement. I don't use loops nor store huge objects like bitmaps etc but my sessions are now gone even faster than 90 minutes in shared application pool before.
I have considered using SQL Session State but there isn't a simple guide on using this with MySQL. I am getting desperate and considering using a public variable, a string as a replacement to store logged in user id instead of in a session variable. I am pretty sure this will solve my issue with sessions being recycled but are there any negative consequences of doing this? One problem I can think of is if the user closes the browser, the system will never know that the user is now logged out and this public variable should be nothing. In this scenario, will the GC eventually clear this abandoned public variable.
What would be the proper syntax in ASP.NEt 3.5 C# to assign a TextBox value to a temporary or session variable to be manipulated (added, subtracted, multiplied, divided) at different points in the application? I want to add a decimal number to this variable in almost every instance as well.
Here when i click on button it insert all data into table but it didn't insert my selected item from dropdownlist it insert select city that i define in page_load
DDL1.Items.Insert(0, new ListItem("select city", "0"));
And when i delete this code from page load it insert in table first row of my table it didn't insert my selected item from dropdown list.
I have the dataset. in this i am having total 20 tables with huge amount of data..I want use this data over all the page..so where i can keep this data..
before i used viewstate but the viewstate data is render to page every postback ..so this time the page size is increasing(interanlly viewstate is rendered to page)..so performence wise it was very slow..
Now i change my logic insted of viewstate to i used Globel Dataset on Page Level.. now the performence wise better than viewstate..
i used Like shared dsControls as Dataset at top of the page..so every time i use this dataset..
my quesation is session is better or Globel variable is better way use in my situavation..
I added the following code to global.asax to load up several session variable when a session starts. I'm assuming that when a page goes to use the variable that I should be
1) checking at the page level that the value is valid not 0 when its not expected to be 0, not a zero-length string when its expected to have a length
2) have code at the page level that sets the values if the values have not been set as when the Session timeout, ideally putting the code in a class derived from Page and then deriving all of my pages from the new class so that the code does not have to be repeated in every page