WOW. That turned ugly (apparently you should not copy and paste code from VS!). Trying again. I have sites where I do not want a login button/link to appear on the site. I figure why show the casual visitor that logging on is even an option. If my site is say, www.mysitename.com, I set it up so that to get to the login screen, the user goes to edit.mysitename.com. This is how I do it:
In the SiteUrls.config, I have this line:
<RewriterRule>
<LookFor>http\:\/\/edit\.(.*)</LookFor>
<SendTo>http://www.$1?ctl=Login</SendTo>
</RewriterRule>
I add edit.mysitename.com as a portal alias and register the subdomain with my hosting provider.
I place this tag on top of my skin.ascx page:
<%@ Register TagPrefix="dnn" TagName="LOGIN" Src="~/Admin/Skins/Login.ascx" %>
And this tag at the bottom of my skin.ascx page:
<dnn:LOGIN runat="server" id="dnnLOGIN" CssClass="skinuser" />
Finally, this code shows the logout link if the user is logged in, but does not show the login link if the user is not logged in:
If Page.User.Identity.IsAuthenticated = True Then
Me.dnnLOGIN.Visible = True
Else
Me.dnnLOGIN.Visible = False
End If
This works for me. Visitors do not see an option to login, editors can easily remember the edit.mysitename.com URL to get to the login screen, and the logout link appears after the user logs in.