Code: Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click Dim blnLogin As Boolean blnLogin = Login(txtUserLogin.Text, txtPassword.Text) If blnLogin = True Then
[Code] .....
So after the user presses the Login button there should be 3 variables stored in a session, this works (checked using trace='true')
Session State Session KeyTypeValue LoggedInSystem.String LoggedInUserSystem.StringUser LoggedInIDSystem.Int322
That's fine. Now I click on the AddToWall button to check if I can get the LoggedInID, it shows an empty messagebox.
In the trace there are no Sessions keys left.How can I make it keep the keys after postback/after clicking on buttons?
Note: When calling GetFriends(Session("LoggedInUser")) in the same sub as the Login button the variable does get passed to the class with sub GetFriends()
I have a function that sets the Theme for the page but I want to define this in a MasterPage for each page that uses that MasterPage. This seems like the most likely way to do this to me, am I doing something wrong?
Here is what I have:
[Code]....
If i copy this to an ASPX page it works but it doesn't seem to work at all in a MasterPage.
In my masterpage i have already defined metakeywords and description. But for one of my page i would like to define metakeywords and description which will be for that page only.
The metakeywords and desciption defined in master page is for the website.
Where and How to define metakeywords and desciption for any page which doesn't have <head> tag as it is linked with masterpage.
I have to define a global and unchangeable variable in a web page. I used static variable but its content is the same for all users that use the page and it is bad. I dont want use Session variable.
I define Div in my page and I define background image for my page's Body
body { background:url(../image/BGheader21.png) ; text-align:center; }
now I want the Div that I define, doesn't have any background and it show Body's Background Image in below image imagin that flower is body's background image and div with red border is div that I define I want some thing like below image
I need to access a variable that is declared in a master page to a child page. I'm using asp.net 2.0 (vb). I'm sure this should be easy and is down to my inexperience with asp.net! A rough guide to my code is below;
MASTER PAGE <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> <script runat="server"> Public UserNumber As Integer = 3 End Sub </script> CHILD PAGE <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables
i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?
I have this code in javascript: var x = e.mapX; It gets the X-coordinate of a map. What I want to do is that I want to store this into a c# variable. I have a class named Test with an integer property X. I want to store var x into X. In the codebehind, I have this on the Page_Load: Test test = new Test(); Then I am trying this on the javascript code: var x = e.mapX;
I need to access some variables in a page in web application. The scope of variables is just in that specific page. which one is the solution ? Session or ViewState ? or any better solution ?
Private Property UserId() As Integer Get If Not ViewState("UserId") Is Nothing Then[code]....
I want to move some parts of the html page containing this function to a new web user control. now "form1" is not defined and it is not working correctly without any error message!
I have gotten alot of help lately on my project and think I only have one more issue that I can't think of how to do. What i'd like to do is pass a login name and password from a Login.asp page to all of my other pages. So for instance if I have a successful login, I am taken to the Home.asp page. But i'm not sure how I can pass the LoginID used from Login.asp to the Home page. Ideally i'd like to use this information in the SQL connection strings, and to customize the Home page to show orders assigned to certain people that are logged in.
I'm trying to convert a game I made (WindowsFormApplication) to an ASP.NET page.
My Problem is that I have a lot "private" variables in my WindowFormApplication and those variables are important for the game. But when after I Declare all my variables (in my Page_Load), they turn null no matter what I do(click a button, refresh the page).
Is there anyway to save my variables between buttons (other than Session, because I'd have to create like 6 more sessions)
On my current project I need to pass a variable from a page to another one.I do not have particular problems with that part of the code but my question is more orientated towards the practicality. I want to make sure everything is fine and the user redirect to a "default" page with an error message if it fails.
Page 1 asks the user for some information, on submit the data is stored in the DB and the Index of the row inserted is passed to a second page using a Session variable. What I'd like to do is check the variable on Page 2 and make sure it is fine. If the Id is missing or incorrect I would like to redirect to the error page. But what is the best way of doing so?
At the moment I have this code on the Page_Load of Page2: [Code]....
In the error page I display an error message if the Session["ERROR_MSG"] is set. I basically need to know if this is the right way of doing this kind of check. Is it OK to put it in the Page_Load? Should I use Page_Init?
Possible Duplicate: Where are static variables stored in asp.net aspx page Hi can someone please tell me where the static variables are stored in asp.net aspx page.Is it in the view state? If so I guess you wouldn't want to stored big complex objects?
VS2010/VB/ASP.NET 4.0 If an error occurs in an ASP app you can redirect it to a default page which is defined in the web.config file How can you pass the variables (URL) to the error webpage then to a logfile or sent via an e-mail address?
Example: 404 Error
- Page hosting the link - URL - Search (if applicable)
I am developing an application using Visual Studio 2010 and SQLServer 2008. My application has two pages and the first page contains a GridView with all the records "User Administration" and when user click on any Username (template field ->linkbutton) I read the USERID like this.
which takes it to the Data Entry page where user updates the information and save the data.
The problem i am facing is that when I hit the browser REFRESH button couple of times the session variables looses the value which is trouble for me as I am using Session Variables for different purposes.
I have an app which has a form that used to use AutoPostBack rigged controls (dropdowns, radiobuttons etc.) in an updatepanel, and I used to set session values on each postback. I posted the form using PostBackUrl to an external page, using a bit of javascript OnClientClick to copy my data into meaningfully named hidden fields.
Now, I've had to rewrite the AutoPostBack-ing controls so that all the cascading dropdown work and date calculation etc. is done in JavaScript, and not in C# - no more postbacks, no more updatepanel.
This means I've lost the ability to set my session values on postback. Can anyone think of a solution for setting these before I post my form? I need to set the session variables, plus post (querystrings are not an option) to the external page with the values from my form - and actually send the user to the external page, too.