I need to implement a login/logout feature (for a school assignment). I am using forms authentication. I have an index.html with frames: "top", "side", "main", "bottom". The top frame has a navigation bar with an asp hyperlink. I would like the text for this link to change from "Login" to "Logout" when the user logs in. So I put this code in the Page_Load of Top.aspx:
If User.Identity.IsAuthenticated Then
lnkLogin.Text = "Logout"
Else
lnkLogin.Text = "Login"
End If
In my Login.aspx.vb I have the following code in my btnLogin_Click:
RegisterStartupScript("Reload", "<SCRIPT Language='Javascript'>parent.top.document.Form1.su bmit()</" & "Script>").
The text for the hyperlink does NOT change when the user succesfully logs in. What am I doing wrong?
If anyone has a better way of accomplishing the same thing, if it's not too complicated :), I would love to hear it!
Thank you,
Judy 2 1354
You don't show the rest of your code, but probably the problem is that the
lnkLogin click event is occurring after the page load event. Set breakpoints
to verify this - and then change the text in the lnklogin click event.
"Judy Ward" <Ju******@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com... I need to implement a login/logout feature (for a school assignment). I
am using forms authentication. I have an index.html with frames: "top",
"side", "main", "bottom". The top frame has a navigation bar with an asp
hyperlink. I would like the text for this link to change from "Login" to
"Logout" when the user logs in. So I put this code in the Page_Load of
Top.aspx: If User.Identity.IsAuthenticated Then lnkLogin.Text = "Logout" Else lnkLogin.Text = "Login" End If
In my Login.aspx.vb I have the following code in my btnLogin_Click: RegisterStartupScript("Reload", "<SCRIPT
Language='Javascript'>parent.top.document.Form1.su bmit()</" & "Script>"). The text for the hyperlink does NOT change when the user succesfully logs
in. What am I doing wrong? If anyone has a better way of accomplishing the same thing, if it's not
too complicated :), I would love to hear it! Thank you, Judy
Yes, the btnLogin_Click event happens after Page_Load. I have also tried putting the "Reload" code under the Page_Load event--that didn't work either. The user isn't authenticated until the button is clicked.
When you say, "change the text in the lnklogin click event", do you have any suggestions?
Thank you,
Judy
"Rick Spiewak" wrote: You don't show the rest of your code, but probably the problem is that the lnkLogin click event is occurring after the page load event. Set breakpoints to verify this - and then change the text in the lnklogin click event.
"Judy Ward" <Ju******@discussions.microsoft.com> wrote in message news:BC**********************************@microsof t.com... I need to implement a login/logout feature (for a school assignment). I am using forms authentication. I have an index.html with frames: "top", "side", "main", "bottom". The top frame has a navigation bar with an asp hyperlink. I would like the text for this link to change from "Login" to "Logout" when the user logs in. So I put this code in the Page_Load of Top.aspx: If User.Identity.IsAuthenticated Then lnkLogin.Text = "Logout" Else lnkLogin.Text = "Login" End If
In my Login.aspx.vb I have the following code in my btnLogin_Click: RegisterStartupScript("Reload", "<SCRIPT Language='Javascript'>parent.top.document.Form1.su bmit()</" & "Script>"). The text for the hyperlink does NOT change when the user succesfully logs
in. What am I doing wrong? If anyone has a better way of accomplishing the same thing, if it's not
too complicated :), I would love to hear it! Thank you, Judy
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jenny |
last post by:
Need urgent help for an unsolved problem. In our ASP web application,
we creat a Back button and if user click on this button, it execute
history.go(-1) to go back to the previous page. All our...
|
by: Lex |
last post by:
I want to reload a page only once. Therefor meta refresh is not
suitable, because then it refreshes every x seconds. Is there a
possibility to refresh only once?
regards,
Lex Ouburg
|
by: Chris |
last post by:
I pop up a Modal form on a web page that allows the user to update the
selections of a dropdownlist via adding a new item to the db (Sql Server).The
only thing is this list is on the page beneath...
|
by: riversmithco |
last post by:
This should be easy,
How do I reload a page so that it makes the server think it's the first
time the page has been loaded?
Thanks
|
by: T. J. Fan |
last post by:
I was trying to call from a web page a routine defined in
another page (to reload that page). More specifically, I
need to be able to reload the first page after user did
something on the second...
|
by: pleaseexplaintome |
last post by:
Hi, I have a perl/cgi script that includes dynamically created
checkboxes and file names. When a given checkbox is checked I move the
related file. how do I redisplay the page without the...
|
by: sreemati |
last post by:
Hi everyone,
This is the scenario:
I have two button - Submit and Reset
Submit is used for validation and after validation is passed it passes it to another form to enter into database.
...
|
by: =?Utf-8?B?Sm9obg==?= |
last post by:
Hi,
I used the following code to refresh the parent page, and it works very well
(Thanks to Peter Bromberg ").
Response.Write("<script language='javascript' type='text/javascript'{...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |