Saturday, December 11, 2010

Using master pages and aspx pages in dnn

2 comments
In this post, we are going to see how we can add new aspx pages by re-using the existing skin designs to implement some helpfull programming in it.


Why?


If you are running a multi-portal dnn website and want to build some common pages to share between those portals, there are couple of quick ways to do that.

  1. 1. Create a new tab in portal 0 and then share link in all other portals.
    This technique works fine when you want to show "how to" page or help page, static contents or offers related pages. You don't need any custom coding for this and it will be a matter of adding a text html module and paste the html that you designed!
  2. 2. Create a new aspx page and share link in all other portals.
    Well, this one also looks similar to first option but let's think about this: If you are running a multi-portal dnn site and want to show latest offers from all the portals into a page based on user's country, and users having at least 5 orders in history. Now, this will involve some quick coding to do. So, basically, if you want to show content based on some dynamic parameters like user or portal data or similar data, it will be good to create an aspx page.
There is another option! obviously you can create a new module to do this, but remember that we are not doing anything that depends on moduleId or tabId but depends on UserId or PortalId, so I believe it's a quick way to create a new page in place of building an entire dnn module.

How?

  1. 1. Create a new theme
    Create a new theme with the name of your skin and paste your skin's css and images into it.
  2. 2. Create a new master page
    Create a new master page and paste your skin's ascx control's entire markup over there. Replace all your content pane (i.e. div or tds with runat=server) with CotentPlace holder
  3. 3. Create a new page
    - Add a new aspx page called Default2.aspx and select the new master page when creating it. 
    - Go to .aspx.vb file and make your parial page class inherit from DotNetNuke.Framework.PageBase in place of System.Web.UI.Page 
    - And that's it you are ready to go!

Conclusion

It is really easy to add a new aspx page in dnn that is re-using skin and you will be able to access all the information like PortalSettings, UserInfo etc. Things like Tab and Module will not be there and it's obvious!
This post doesn't say you should create a new aspx page in some cases or not, but demonstrates how to do it if you want. If you have some good examples WHEN we can use it or some good examples WHEN we should NOT use it, I welcome them! 
This example will probably work with dnn 4.x and 5.x, though I've used this in dnn 4.5.6 and 5.2.0 etc.

Downloads

You can download the example code for this example from codeplex Happy coding with dnn

Saturday, December 4, 2010

DotNetNuke 5.6 - A potentially dangerous Request.Form value was detected from the client

1 comments
Today morning, when I was preparing for a new installation instance for dnn 5.6, I was facing trouble to install new module, create new tab and I come to the conclusion that any post back event from the site was causing the "potentially dangerous Request.Form value".

I was still able to install module using /Install/Install.aspx?mode=installresource but finally stuck when I was not able to add the installed module into page.

Finally, after reading several articles on web, I found web.config's httpRuntime element needs another attribute called : requestValidationMode="2.0"

I go the solution here (
http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from-the-client/3368769#3368769).

And finally, I was on my way to regular work.
please note that I was trying this on having webmatrix installed and I was browsing the site in asp.net 4.0 integrated mode.
Hope this will help to someone in the same kind of trouble.