Sunday, June 19, 2016

index DNN Forum content, Need to be sure the search feature works

Host Settings>Search Settings, bottom of the form is Re-Index.

Monday, October 26, 2009

DNN custom logout

protected void LinkButton1_Click(object sender, EventArgs e)
{
DotNetNuke.Security.PortalSecurity.ClearRoles();

Session.Clear();

Session.Abandon();

PortalSecurity objPS = new PortalSecurity();

objPS.SignOut();
Response.Redirect("http://localhost:2887/Site/Home/tabid/39/language/en-US/Default.aspx");
}

Sunday, August 23, 2009

Set IE8 Compatibility Mode in Dot Net Nuke

Microsoft has just released Internet Explorer 8. Unfortunately, some of the pages on our website have some issues when viewed with IE8's default settings. In particular, the styling that we've done on our main page's tab control is causing issues. Users can fix these issues on the client side by selecting compatibility mode (the button to the right of the URL field shown below).






Of course, a client side fix is never a user friendly fix. Thankfully there is a meta tag that can be added to your site to force IE8 to automatically go into compatibility mode.

Our page is built in Dot Net Nuke. The appropriate way to apply this fix for DNN is to add the tag to the default.aspx file that is found in the root directory of your Dot Net Nuke website. Any meta tag that is placed in here should be applied to all pages to your website. Add the tag highlighted below in red at the top of the head section of the default.aspx file.

< id="Head" runat="server">
< equiv="X-UA-Compatible" content="IE=EmulateIE7">
< content="text/html; charset=UTF-8" equiv="Content-Type">

Note that the tag must be placed at the top of the head section. Also, be aware that updates of your DNN framework will overwrite this change.

Tuesday, August 18, 2009

Create DotNetNuke Page Description And Meta Tags Dynamically

public DotNetNuke.Framework.CDefault BasePage
{
get { return (DotNetNuke.Framework.CDefault)(Page);
}
}

protected override void OnInit(EventArgs e)
{ base.OnInit(e); BasePage.Author = "John Doe"; BasePage.Comment = "Some Comment"; BasePage.Copyright = "Some Organization"; BasePage.Description = "Some Description"; BasePage.Generator = "Some Generator";
BasePage.KeyWords = "Keyword A, Keyword B" BasePage.Title = "Some Title";
}

Monday, August 17, 2009

Check ajax installed or not in dnn at page load

if (DotNetNuke.Framework.AJAX.IsInstalled())
DotNetNuke.Framework.AJAX.RegisterScriptManager();

Wednesday, August 12, 2009

Redirec from one module to other

Step 1:

Response.Redirect(Util.RedirectUrl(this.PortalId, this.TabId, "ControlName", "ModuleName"), false);

Step 2:

public static string RedirectUrl(int PortalId, int TabId, string ControlName, string ModuleName, string Querystring)
{
string _Url = string.Empty;
ModuleInfo objModule = GetModuleByDefinition(PortalId, ModuleName);
return DotNetNuke.Common.Globals.NavigateURL(objModule.TabID, ControlName, "mid=" + objModule.ModuleID.ToString(), Querystring);
}
/////////////////////OR if using querystring

public static string RedirectUrl(int PortalId, int TabId, string ControlName, string ModuleName, string Querystring)
{
string _Url = string.Empty;
ModuleInfo objModule = GetModuleByDefinition(PortalId, ModuleName);
return DotNetNuke.Common.Globals.NavigateURL(objModule.TabID, ControlName, "mid=" + objModule.ModuleID.ToString(), Querystring);
}

Friday, July 10, 2009

How to create custom change password control

protected void btnChangePassword_Click(object sender, EventArgs e)
{
string UserName = HttpContext.Current.User.Identity.Name;
DotNetNuke.Entities.Users.UserInfo userInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(PortalId, UserName);
DotNetNuke.Security.Membership.MembershipProvider membershipProvider = DotNetNuke.Security.Membership.MembershipProvider.Instance();
if (membershipProvider.PasswordFormat == DotNetNuke.Security.Membership.PasswordFormat.Encrypted)
{
string oldPassword = DotNetNuke.Entities.Users.UserController.GetPassword(ref userInfo, userInfo.Membership.PasswordAnswer);
if (oldPassword == txtOldPassword.Text)
{
string newPassword = txtNewPassword.Text.Trim();//DotNetNuke.Entities.Users.UserController.GeneratePassword(membershipProvider.MinPasswordLength);
DotNetNuke.Entities.Users.UserController.ChangePassword(userInfo, oldPassword, newPassword);
txtOldPassword.Text = "";
txtNewPassword.Text = "";
txtOldPassword.Focus();
lblmsg.Text = "Password changed successfully.";
}
else
{
lblmsg.Text = "OldPassword did not match.";
}
}
}