Skip to content
January 3, 2011

Custom event log in Dotnetnuke

Hello,

Easy way to log events in the event log is as follows

Method 1:

DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

objEventLog.AddLog(“Error Message”, “Some error has occurred while processing”, PortalSettings,UserInfo.UserID, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);

Method 2:

DotNetNuke.Services.Log.EventLog.LogInfo logInfo = new DotNetNuke.Services.Log.EventLog.LogInfo();

logInfo.LogUserID = UserId;

logInfo.LogPortalID = PortalSettings.PortalId;

logInfo.LogTypeKey = EventLogController.EventLogType.ADMIN_ALERT.ToString();

logInfo.AddProperty(“Test Property 1″, StringValue1);

logInfo.AddProperty(“Test Property 2″, StringValue2);

eventLog.AddLog(logInfo);

January 3, 2011

Creating a custom exception in Dotnetnuke

Hello,

There is a very simple way of creating a custom exception in dotnetnuke. All that you need is the custom text as the error message as shown below.

DotNetNuke.Services.Exceptions.Exceptions.LogException(new Exception(“Error processing information”));

April 26, 2010

Changing the module title on runtime in dotnetnuke

I was recently working on something related to displaying the module title for a dotnetnuke module at runtime. It’s quite simple, here’s how to achieve it.

Put the code mentioned below either in the Page_Load or the Page_PreRender events

Control m_Control = DotNetNuke.Common.Globals.FindControlRecursiveDown(this.ContainerControl, “lblTitle”);
if ((m_Control != null))
{
((Label)m_Control).Text += “This is the module title”;
}

That’s it!

February 22, 2010

Set default value to a property

Hello !

Just a few days back I found out that setting default values to a property is very simple, Just follow the steps mentioned below -

  1. Make sure that you are using System.ComponentModel – (using System.ComponentModel;)
  2. Set the [DefaultValueAttribute("")] before the property

e.g.

[DefaultValueAttribute("")]
public string Website
{
get { return m_website; }
set { m_website = value; }
}

DefaultValueAttribute accepts various parameters, Use the desired one.

February 5, 2010

ASPNET user not created after the microsoft framework installation

Recently I ran into a problem where I had to format my machine and then get VS 2008 and SQL Server 2005 installed on my machine all over again. The installation went through fine but for some reason while installing DNN I was unable to find aspnet user (I needed it to give appropriate permissions to the DNN install folder). I am sure you guys might sooner or later run into the same problem.

The solution is really very simple. Just browse to the framework 2.0 folder and reset framework 2.0 as the currently installed framework by using aspnet_regiis -i

That’s it, Now try to find the user and you should be able to find it and set appropriate permissions on the DNN install folder.

January 2, 2010

Debugging the javascript using the “Debugger” keyword

Dotnetnuke developers usually write custom javascripts to meet their project needs or need to debug the pre-existing ones, they usually find it difficult to debug javascript. I came across a very simple way to get the visual studio IDE to debug javascript.It is using the “debugger;” keyword. Before using this there are a couple of things that you will have to do,

  1. Open up IE and select the “Tools->Options” menu
  2. Uncheck the disable script debugging(Internet Explorer)
  3. Uncheck the disale script debugging(Other)
  4. All the you have to do now is to place the “debugger;” keyword in the javascript at the place where you want the javascript to break

With the above mentioned steps you will be able to break into the code and the control will be returned to the visual studio IDE.

January 2, 2010

Failed to access IIS metabase while installing dotnetnuke

Probable Cause -

You usually get this error when the framework 2.0 for some reason has not installed correctly as a result of which ASPNET user does not have sufficient access rights on the IIS metabase.

Solution -

  1. Click start->Run
  2. Enter text “cmd” and click the OK button
  3. Above mentioned steps opens up the command prompt. Navigate to the framework 2.0 folder which will be at the “c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727″ location
  4. At the prompt enter “aspnet_regiis -i” this option will install the framework 2.0 as the current version and update the scriptmaps at the IIS metabase root and for all the scripts below the root.

That’s it you are all set !

July 15, 2009

Clearing the dotnetnuke search tables

Hi,

Incase you are setting up search in dotnetnuke, you will need to clear all the tables in which the keywords and other information related to the search is stored.
An easy way to achieve this is using the following script that I found on Chris Hammond’s blog.
DELETE SearchItemWordPosition
WHERE SearchItemWordId IN (SELECT SearchItemWordId FROM SearchItemWordWHERE SearchItemID IN (SELECT SearchItemId FROM SearchItem))
DELETE SearchWord
WHERE SearchWordsId IN (SELECT SearchWordsId FROM SearchItemWord
WHERE SearchItemID IN ( SELECT SearchItemId FROM SearchItem))
DELETE SearchItemWord WHERE SearchItemId IN (SELECT SearchItemId FROM SearchItem)
DELETE SearchItem
Just reindex the search and checkout the results !
July 15, 2009

Unable to start debugging on the web server.The web server is not configured correctly.

Setting up a DNN source project can be easy and difficult at the same time. Since this is an open source product code files have been modified by more than 1 DNN developer.

Recently I tried installing a source version on DNN 04.09.04. It was pretty simple and it worked like a charm, the problem started when I installed the source version (01.00.05) of the active directory module. I included it successfully in the project and hit the F5 button of the VS 2005 only to know that I received an error “Unable to start debugging on the web server.The web server is not configured correctly.”

Here’s what helped me fix the problem -

  1. Right click the DotNetNuke.Authentication.ActiveDirectory.VS2005 and select the “Properties” option
  2. Select the “WEB” tab of the project properties
  3. In the “Servers” option incase “Use IIS Web server” option is selected, ensure that the project URL is the correct one, also ensure that the “Override application root URL” is the correct one.
  4. Click the Save button from the toolbar.

Now just hit F5 and the application should run fine.

Follow

Get every new post delivered to your Inbox.