I'm using the DNN AD authentication provider on several sites and we needed to disable the ability for the user to logout of the site, as that can cause issues with the AD auto login feature.
First, I removed the login code from the .ascx skin file (usually located at Portals/_default/Skins/SKINNAME/SKINFILE.ascx). Here's the code that needs to be commented out or removed:
<div id="Login"> <div class="user_position"> <dnn:USER ID="dnnUser" runat="server" LegacyMode="false" /> <dnn:LOGIN ID="dnnLogin" CssClass="LoginLink" runat="server" LegacyMode="false" /> <dnn:LANGUAGE runat="server" id="dnnLANGUAGE" showMenu="False" showLinks="True" /> </div> </div>
Now that the login control is gone, the user can't logout, which is excatly what was needed. However, I still wanted to display the logged in users name in the header so they know that they are logged in.
- First register the skin text control by adding the following code to the top of your skin ascx file. You can add it right below the other registers at the top of the file
<%@ Register TagPrefix="dnn" TagName="TEXT" Src="~/Admin/Skins/Text.ascx" %>
` 2. Now add this code where you'd like their username to show up:
<dnn:TEXT runat="server" id="dnnTEXT" CssClass="MyTitleHeaderText" replaceTokens="True" ShowText="[User:Username]" />