Tuesday, March 23, 2010

Hack Your DotNetNuke Site - Sample File Included

Wow - check out this post from ArrowNuke. Make sure you review this and make sure that your site cannot be hacked using this IIS security hole.
Hacking Your DotNetNuke Site - Sample File Included

Tuesday, September 9, 2008

Dynamically Switching DotNetNuke StyleSheets with the Current Language

If your design requires you to embed text in an image in a multi-lingual DotNetNuke website, embed your text into images and switch them with CSS.

Simply override the styles from the base module.css stylesheet in a separate stylesheet and switch them dynamically using the following line of code directly in your skin:


<link href="<%= SkinPath %>languagespecific-<% =CType(Page, PageBase).PageCulture.Name %>.css" rel="stylesheet" type="text/css" />


This will be rendered as the filename languagespecific-en-US.css in the root of your skin for the default DNN language and switch every time the user switches their language.

Happy Nuking,

Ryan Morgan
Arrow Consulting & Design

Arrow Consulting & Design is a consulting firm based in West Palm Beach, Florida specializing in DotNetNuke, ASP.NET, SQL and WPF Development with a portfolio filled with local, national, government and global enterprise clients.

Case Studies: Click Here
Main Corporate Site: http://www.arrowdesigns.com/default.aspx?utm_source=blogspot
DotNetNuke Community Site: http://www.arrownuke.com/default.aspx?utm_source=blogspot
Consulting Inquiries: Click Here
Skin Design/Conversion: Click Here
DotNetNuke Portfolio: Click Here

Saturday, August 16, 2008

Hiding Sections from Unauthenticated Users in DotNetNuke Skins and DNN Skin Conversions

A lot of times, when creating a DotNetNuke skin, I find the need to hide a certain link, text or skinobject in my dnn skin to users that are not logged in. There is a super-simple way to do this, if you add in a little server side code into your skin conversion.

For this example, I wanted to hide the User DotNetNuke skin object. This is for an e-commerce website, so it made sense to only have users register during the checkout process and hide the "Register" link that shows up to unauthenticated users.

<% If Request.IsAuthenticated Then%>
<%dnn:user id="dnUser" runat="server"%>
<%% End If%%>

The way this works is that anything within that server-side if statement is displayed at runtime if the user is logged in.

You could also switch it so that you have a section that only shows up in your skin if the user if not authenticated by changing it to

<% If Not Request.IsAuthenticated Then%>
<%span class="NormalRed"%> You're Not Logged In!<%/span%>
<%% End If%%>

If you're interested in creating custom role access for sections of skins, checkout my last blog post here: http://dotnetnuke-skin.blogspot.com/2008/08/creating-custom-role-to-display-admin.html

Happy Nuking,
Ryan Morgan
Arrow Consulting & Design


Arrow Consulting & Design is a consulting firm based in West Palm Beach, Florida specializing in DotNetNuke, ASP.NET, SQL and WPF Development with a portfolio filled with local, national, government and global enterprise clients.

Case Studies: Click Here
Main Corporate Site: http://www.arrowdesigns.com/default.aspx?utm_source=blogspot
DotNetNuke Community Site: http://www.arrownuke.com/default.aspx?utm_source=blogspot
Consulting Inquiries: Click Here
Skin Design/Conversion: Click Here
DotNetNuke Portfolio: Click Here

Saturday, August 9, 2008

Creating a Custom Role to Display the Admin Control Panel

In my last DotNetNuke skinning post at http://dotnetnuke-skin.blogspot.com/2008/08/positioning-admin-control-panel-in-dnn.html I discussed how to position your admin control panel when creating a custom dnn skin. By adding the control panel declaritively instead of letting the DotNetNuke framework place it automatically at the top, you are able to place it where you want and access it through server side or JavaScript code in the skin.

For this post, we will focus on how to create a custom role that controls which users have access to the control panel.

First, create a custom role for your portal. Let's call it "Control Panel Access".
Next, create a new user for testing called cptest.
Next, manage the roles for the user and add them to the Administrators and Control Panel Access roles.

Now, we'll add the following code to the top of the skin:

<script runat="server">
Private Sub module_load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
If Not DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().IsInRole("Control Panel Access") And Not DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().IsSuperUser Then
ControlPanel.Visible = False
End If
End Sub
</script>
<div id="ControlPanel" runat="server" />


What's happening here is simple, our script checks the currently logged in user to see if the user is either in the "Control Panel Access" role that we setup at the beginning of the post or a Host user. If neither of those conditions are true, then the control panel is hidden.

Happy Nuking,

Ryan Morgan


Arrow Consulting & Design is a consulting firm based in West Palm Beach, Florida specializing in DotNetNuke, ASP.NET, SQL and WPF Development with a portfolio filled with local, national, government and global enterprise clients.

Case Studies: Click Here
Main Corporate Site: http://www.arrowdesigns.com/default.aspx?utm_source=blogspot
DotNetNuke Community Site: http://www.arrownuke.com/default.aspx?utm_source=blogspot
Consulting Inquiries: Click Here
Skin Design/Conversion: Click Here
DotNetNuke Portfolio: Click Here

Positioning the Admin Control Panel in a DNN Skin

Most times the default placement for the administration control panel doesn't cause any problem, but if you want to move the control panel in a dotnetnuke skin while you're creating your custom dnn skin you can easily do that by using the appropriate naming convention.

Similar to how your ContentPane is placed by naming an HTML container like a table cell (TD) or div correctly with the runat="server" attribute, you simply need to name a containing HTML element with the id "ControlPanel".

Example:
<div id="ControlPanel" runat="server"/>

With this knowledge, we can add a small server-side script to the top of the skin that can manage the visibility of the control panel. In my next post, I'll show you how to use this to use a custom role to display the control panel to a designated role. (View the post here: http://dotnetnuke-skin.blogspot.com/2008/08/creating-custom-role-to-display-admin.html)

Happy Nuking,

Ryan Morgan




Arrow Consulting & Design is a consulting firm based in West Palm Beach, Florida specializing in DotNetNuke, ASP.NET, SQL and WPF Development with a portfolio filled with local, national, government and global enterprise clients.

Case Studies: Click Here
Main Corporate Site: http://www.arrowdesigns.com/
DotNetNuke Community Site: http://www.arrownuke.com/
Consulting Inquiries: Click Here
Skin Design/Conversion: Click Here
DotNetNuke Portfolio: Click Here