Web Forms :: Use The MasterPage To Check The Availability Of A Session?
Jan 30, 2011
I have a web site using master page and login page. I use the MasterPage to check the availability of a session. I'm coding with VB + MS Access database.I believe something is wrong with my master page and I can't figure it out. In the code behind of the MasterPage, I try to check the user session is available. If so, the user is still logged and get access to all the menu. If no session is available, it means the user is logged out and few menu as shown. Here is the code
[Code]....
Please note that my Login.aspx page is also base on the same MasterPage. On the Login.aspx.vb, if the user credential are correct, I did this:
[Code]....
So my logic is this: when the web site is launched MasterPage + Default.aspx load. So Sesson("MyLink") is empty. If the user's credential are correct, I create the session so the it can be available for MasterPage.My default menu isMenuPublic1, MenuPublic2, MenuPublic3When a user logged in, I add to the MenuPublic some reserved menu like below.MenuPublic1, MenuPublic2, MenuPublic3, Menu_Users1, Menu_Users2, Menu_Users3I'm testing my application on two different web hosting server: aspspider.com and somee.com. In the local, everything works perfectly fine.My problem is that on aspspider.com if a user logged in and then click on any MenuPublic, the application does not let him show information from Menu_Users. It's wrongly sending him to the login.aspx but still show his profil on the masterpage and the "welcome username" with beside the Logout link. It seems like the user is still connected but cannot have access to users pages.On the other server (somee.com), even if the user logged in successfully, I still have "welcome guess" with beside the Login link. I also have the user's profil information with all the links. If a user click on any MenuPublic, he can still see all the Menu_Users. But if he clicks on any Menu_Users, the application redirect him to the login.aspx; but still displaying all the information as if he is logged.The package deployed on both server is the same; except the connection string.FYI, I have Global.asa in the package but I don't use it. The web.config has plenty of stuff that came when I first start the project. The only thing I added is the connection string.
View 2 Replies
Similar Messages:
Jun 16, 2015
I am refering the below link .. how to call or use it from master page.
[URL]....
and is there any change in webconfig for visualstudio 2012.
View 1 Replies
Jul 29, 2010
I have tried the following solutions in my ASP.Net(C#) website for which I had previously configured ASP.Net membership module.http://riderdesign.com/articles/Check-username-availability-with-JQuery-and-ASP.NET.aspxhttp://www.ajaxlines.com/ajax/stuff/article/validate_username_using_jquery_ajax_json_and_aspnet_web_method.phpBut when my username textbox losses focus, a following error appears besides my textbox,
[Code]....
Why it is giving this error? Why it is not locating CheckUserName() function that I have added in myPage.aspx.cs file which is it admin's folder?Is it the path issue that I have given in JSON? or its due to something else !!!
View 4 Replies
Jan 12, 2011
i am new in asp.net form authentication and sessions
i would like to know how to save session in masterpage or in global.asax and how to clear session.
how to better handle session timeout by redirecting to a page.
this is my web.config session settings
<sessionState mode="InProc" cookieless="false" timeout="1"></sessionState>
code in my masterpage
[code].....
View 2 Replies
Jan 23, 2010
I've a user registration page in which i take email address as input by user. But i wanna check that the given email address is a valid (I mean registerd address or not) or not. It's not syntax validity check.I want to check the availability that means the given address is there in web or not.
View 3 Replies
Sep 13, 2010
I have a forgot password page in which i need to ask from the user his user id to provide him his password from the database and it is working but what to do if anyone enters any wrong user id.
View 6 Replies
Feb 24, 2011
I want check userid availability on registration from like timesjobs com,(a small progess image till query processing)
i have one registration form in which userid and password field filled by user.
i want to check the userid availability which is entered by user .
View 4 Replies
Jun 30, 2012
I have tried code, but there is error...
Compilation Error:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1525: Invalid expression term ')'
Source Error:
Line 8: <script type = "text/javascript">
Line 9: function ShowAvailability() {
Line 10: PageMethods.CheckUserName(document.getElementById("<%=txtUserName.LoginID%%>").value, OnSuccess); Line 11: }
Line 12: function OnSuccess(response) {
View 1 Replies
Feb 18, 2011
I have made a user signup form in asp.net. I want to check the user availability from user table made in sqlserver without postbacking of the page to the server.
Checking user availability when the focus out from textbox or during text change.
View 1 Replies
Sep 24, 2010
I'm trying to performa an ajax validation for e-mail address. I need to know if user is already registered so I need to check it in my database. There is similar example:
[code]....
My current code is:
[code]....
View 3 Replies
Aug 27, 2013
If i have a page in which I want to check whether session is null.
If it is null it will redirect to other page.
But i also have a if (!Page.IsPostBack)
so i will check the session inside this if (!Page.IsPostBack) or outside it?
View 1 Replies
Apr 4, 2011
I'm having a hard time with the page cycles when using masterpages and contentpages. My masterpage has two linkbuttons that are used to select a language (using resources). When these buttons are clicked I create Session["language"]. The goal I have is to 'translate' my masterpage after the buttons are clicked AND to translate the content page.I've been trying all kinds of different methods (Page_Load etc) based on this url: http://msdn.microsoft.com/en-us/library/dct97kc3.aspx but it never works like it should. Usually the content page only gets translated after two clicks. I can't figure out the cycle problem between the masterpage and the content page combined with the click-events.
View 1 Replies
Mar 23, 2011
I have a web site coded with VB + MS Access database (VS2010). I'm using one MasterPage to manage both public and users area. I'm facing loss of session variables when a user is logged in. I can't figure out what is wrong and I need your help, tips and tricks.
When a user is authenticated (thru the Login.aspx), I create a SessionID, store his credential in session and load user's page by Response.Redirect(~/users.aspx). Here is what I did:Code:
Dim MyLink As String = Session.SessionID & "other variables"
Session("MyLink") = MyLink
FormsAuthentication.RedirectFromLoginPage(TextBoxEmail.Text, False)
Response.Redirect(~/users.aspx)
My logic is this: when the web site is launched, MasterPage + Default.aspx load. So Session("MyLink") is empty. If the user's credentials are correct, I create the session so that it can be available for MasterPage.
In the code behind of the MasterPage, I try to check (everytime a link is clicked/page requested) whether the user session (SessionID, credential in session) is available. If so, the user is still logged and get access to all the menu. If no session is available, it means the user is logged out or not logged in yet and few menu are shown. Here is the code
Dim MyLink As String = Session("MyLink")
If MyLink Is Nothing Then
'Only show MenuPublic
[code]....
My default menu is:MenuPublic1, MenuPublic2, MenuPublic3
When a user is logged in, I add to the MenuPublic some reserved Users' menu like below.
MenuPublic1, MenuPublic2, MenuPublic3, Menu_Users1, Menu_Users2, Menu_Users3
In local, everything works perfectly fine. Now after hosting my website, from time to time the MasterPage loss the Session variables. When it happens, the page still shows that the user is logged in by displaying Logout and Welcome Username beside it.
View 7 Replies
Mar 12, 2010
I'm new to asp world, and I have to keep my new job :)Switching form php to asp.net 3.5 (never used before). What would be the best practice for storing a SESSION variable in my project ?How can I prevent my SESSION to be overwritten if my initialisation code is in the onPageLoad method of my MasterPage ?My variables keeps beeing overwritten, please someone help me and tell me if there is any other solution than dealing with this pageLoad problem.
View 3 Replies
May 10, 2010
how can i check a session on my master page
View 4 Replies
Nov 8, 2010
I am working on some refactoring work from cold fusion to .Net and I have a login page which redirects to a mainpage --> aaa.aspx. It displays the current news from the database and then I have some links coming from the masterpage which are embedded inthe same page as well. This masterpage has links to pages which are in both .Net and CF.When the aaa.aspx was initially in Coldfusion, it would redirect to all these links in the masterpage without any issues, but from the time I re-wrote the aaa.cfm to aaa.aspx, the links in the master page that are embedded in the aaa.aspx would not work,i.e they would redirect back to the Login page. My session looks like it is persisting to the aaa.aspx page, but not to the master page elements.At this point, I am not sure as to what is causing this issue.
View 1 Replies
Oct 21, 2010
I am creating some sessions on successful login and I need to access them from my master page. How do I go about this?
public void showUser()
{
if (!string.IsNullOrEmpty(Session["User"].ToString()))
{
Response.Write(Session["User"].ToString());
}
else
{
Response.Write("Not Logged In");
}
}
View 1 Replies
Jul 15, 2010
Situation:In Web.Config we have CustomErrors turned on with redirectMode="ResponseRewrite".In Page_Load of our MasterPage we access the Session property of the Page.
Problem:When an Error occurs on any page the user gets redirected (via Rewrite) to our Error.aspx Page. There in the Page_Load of the MasterPage we access the Session and get an HttpException telling us to enable SessionState. But we have the SessionState enabled, definitly.
Question:How can we access the session after a UrlRewrite in the Page_Load Event of our MasterPage?
View 2 Replies
Dec 16, 2010
In my application, session value automatically set into null.In certain workflow only it will set as null (Normally It's able to access value). Example, at the time of login, I will set session values. While, user deleting some entries from drop down list of specifc page,client script will show message like selected entry deleted. After that, flow point will move to master page. There I have to access session variables. It's getting null value. I tried to debug with Quick watch, at the pageload of master page only value set into null (automatically).
View 6 Replies
Feb 4, 2010
I have a MasterPage (MasterPage.master) with 2 child MasterPages (specialMaster.master and standardMaster.master). From the MasterPage.master I need to get at some of the controls in one of the children, specialMaster.master, say for example to hide certain
content if a session variable is not null.
View 2 Replies
May 3, 2010
I have 2 masterpages. (Default.master and User.master).I have a hidden field in Default.master then how can i get the hidden field value of Default.master file from User.master.is there any way to access that hidden field like: Request.form("hidID") ?
View 2 Replies
Sep 22, 2010
I tried some code in Application_Error like this Session["mysession"] = "Some message"; but the problem is sometimes session is not available in Application_Error. So I want to check whether session is available or not.
View 1 Replies
Sep 8, 2010
I have a function inside a utility class which returns the current session User ID.
It throws object reference not set to instance of object ? How do I check it for null & remove this error ?
public static string GetSessionUserID
{
get
{
string userID = "";
if (System.Web.HttpContext.Current.Session["userID"].ToString() != null)
{
userID = System.Web.HttpContext.Current.Session["userID"].ToString();
}
if (userID == null)
{
throw new ApplicationException("UserID is null");
}
else
return userID;
}
}
View 2 Replies
Apr 8, 2010
how to check whether users is authenticated and session is valid on pages after say 30 mins.
View 3 Replies
Jun 10, 2010
Is there a way you can call a function, or make a file that runs before every page load. I want to be able to check if they have a valid session before showing the page.
View 4 Replies