Does anyone know how difficult it would be to make one of the tab's or links invisible unless someone is logged in? I'm using JW's extended kit and am building a video page I would only like visible to people who have a resistered username and password.
If it is a link you added to the page use a Page Load event, of course set the default value to false and add a Page Load event on the restricted page to redirect unauthenticated users if they try to type the url in the address bar.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If User.Identity.IsAuthenticated = True Then
LinkButton1.visible = True
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If User.Identity.IsAuthenticated = false Then
Response.Redirect("Deault.aspx")
End If
First, excuse my lack of knowledge - I'm very new to ASP.NET.
I have implemented this solution exactly as detailed and have two problems with it.
1) If I try to access "RestrictedPage.aspx" by typing in the URL, without logging in first, I get redirected to the login page, not the Default page.
2) If I login, and then logout and then try to access "RestrictedPage.aspx" by typing in the URL, I get access to the page, showing I'm still logged in.
The redirect to the login page is done by the Web.config option. Ideally that is where the second option should redirect also I just put default.(misspelled by the way) If using the Web.config option you do not need the Page load option.
The second issue is comming from the temporary internet files, it is not a cookie issue as I tried clearing just cookies and that did not solve it, but when I clear Temporary Internet files( through the options menu in IE7) it does.
Member
1 Points
41 Posts
Guestbook or any other tab/link made invisible unless logged in?
Dec 09, 2007 03:40 PM|tcorneto|LINK
Does anyone know how difficult it would be to make one of the tab's or links invisible unless someone is logged in? I'm using JW's extended kit and am building a video page I would only like visible to people who have a resistered username and password.
Thanks!
Participant
821 Points
464 Posts
Re: Guestbook or any other tab/link made invisible unless logged in?
Dec 09, 2007 06:38 PM|MaineOne|LINK
I never tried that version but,
If the link is coming from the sitemap you can add this to the web.config
End Sub
Member
1 Points
41 Posts
Re: Guestbook or any other tab/link made invisible unless logged in?
Dec 10, 2007 06:55 PM|tcorneto|LINK
The changes you suggested to the web.config file worked perfectly. That was easy!
Thanks
Member
3 Points
16 Posts
Re: Guestbook or any other tab/link made invisible unless logged in?
Dec 14, 2007 06:36 AM|NTBF|LINK
First, excuse my lack of knowledge - I'm very new to ASP.NET.
I have implemented this solution exactly as detailed and have two problems with it.
1) If I try to access "RestrictedPage.aspx" by typing in the URL, without logging in first, I get redirected to the login page, not the Default page.
2) If I login, and then logout and then try to access "RestrictedPage.aspx" by typing in the URL, I get access to the page, showing I'm still logged in.
Any suggestions ?
TIA,
Mike
Participant
821 Points
464 Posts
Re: Guestbook or any other tab/link made invisible unless logged in?
Dec 14, 2007 10:42 AM|MaineOne|LINK
The redirect to the login page is done by the Web.config option. Ideally that is where the second option should redirect also I just put default.(misspelled by the way) If using the Web.config option you do not need the Page load option.
The second issue is comming from the temporary internet files, it is not a cookie issue as I tried clearing just cookies and that did not solve it, but when I clear Temporary Internet files( through the options menu in IE7) it does.