Friday, April 29, 2005

MCMS Manager - The Best Article for March 2005 [CodeProject]

Today Code Project have announced MCMS Manager as the best article of the month in ASP.NET category.

It happened because of all the support and feedbacks I received from you! I want to thank those who gave me all the support and feedbacks. They truly helped me to make MCMS Manager more usable. My thanks goes to Rick Mason, Wolfgang Schober, David Humphreys, Austrian, Justin Drerup, Rob Rohr, Ajay Mistry, Spencer Harbar, Andrew Connell, Nick, Sachintana, Sanjaya and all others who have motivated me. Thanks a lot!

Also I wanted to thank Brice Dunwoodie for his nice article about MCMS Manager on CMS Wire!

Tuesday, April 26, 2005

MCMS Manager 2.0

Now with few new features,

1. Resource Gallery
- Can Check resource related things
- Save the resource
- Get the resource dependency
- and more

2. Template Gallery
- Can Check template related things
- Get the template usage
- and more

Currently it is not available in CodeProject & GotDotNet (I think it will take some time to update) . It can be downloaded from Sourceforge now. Please post your feedbacks!

Monday, April 25, 2005

HttpModule to solve glitches when using a posting as login form

Via Stefan :

HttpModule to solve glitches when using a posting as login form

When I used this module I got in to a problem.

Recreation of the issue:

1. Create a posting as admin
2. Submit it for approval
3. Go to Approval Assistant and approve it from there

Even though it approves the posting it throws this exception:

A posting created and approved with the name 'TestApproveViaAssitant' Approve operation of the selected pages was unsuccessful.
Microsoft.ContentManagement. Publishing.CmsInvalidObjectStateException: Invalid version for current Posting. The object referred to by this Web request has already been retrieved by another mechanism, for example Searches.GetByGUID. The version of the object requested by this Web request is not consistent with the previously retrieved version. ---> System.Runtime. InteropServices.COMException (0x80041B5B): Invalid version for current Posting. The object referred to by this Web request has already been retrieved by another mechanism, for example Searches.GetByGUID. The version of the object requested by this Web request is not consistent with the previously retrieved version. atMicrosoft.ContentManagement. Interop.Publishing. CmsHttpContextClass. get_Posting() at Microsoft. ContentManagement. Publishing. CmsAspContext. get_Posting() --- End of inner exception stack trace --- at Microsoft. ContentManagement. Publishing. CmsAspContext. get_Posting() at Microsoft. ContentManagement. WebAuthor. ApprovalAssistant. OnPostingApproveDecline(Object sender, EventArgs e)


I was never heard of this issue with approval assistant before. So I was digging bit in on CmsAuthorizationModule and came up with a bit different EnhancedCmsAuthorizationModule which worked without any problem.

Modified code :

using System;
using System.Web;using System.Configuration;
using Microsoft.ContentManagement.Publishing;
using Microsoft.ContentManagement.Web.Security;
namespace StefanG.HttpModule
{

public class EnhancedCmsAuthorizationModule: IHttpModule
{
public virtual void Init(HttpApplication application)
{
if (application == null)
{
throw new ArgumentNullException("HttpApplication == null");
}
// register new Authorization handler
application.AuthorizeRequest += new EventHandler(this.OnAuthorizeRequest);
}

public virtual void Dispose()
{
// nothing to do
}

private void OnAuthorizeRequest(object source, EventArgs e)
{
HttpApplication httpApplication = (HttpApplication)source;
try
{
// lets try to retrieve the current CmsHttpContext
CmsHttpContext cmsContext = CmsHttpContext.Current;
// ok, we got the context. Now lets see if we have permission
// to access the current item.
// If not, lets present the login page to the user
if (!cmsContext.UserHasRightToBrowse())
{
redirectToLoginPage(httpApplication);
}
if (!cmsContext.ChannelItemIsVisible())
{
cmsContext.Dispose();

}
catch (CmsAccessDeniedException)
{
// ok, no luck accessing the context. Access denied.
// We need to logout and redirect to login page
redirectToLoginPage(httpApplication);
}
}

private void redirectToLoginPage(HttpApplication application)
{
// throw away old authentication token to allow access
// to logon posting as guest user
CmsFormsAuthentication.SignOut();
// get the URL to the login posting from the appSettings section of
// the Web.Config
string loginUrl = ConfigurationSettings.AppSettings["LoginUrl"];
// we need to call the login page with the ReturnURL to the item we
// tried to access if possible we will use the friendly URL
string ReturnURL = HttpUtility. UrlEncode (application. Context. Request. QueryString ["NRORIGINALURL"]);
if (ReturnURL == null)
ReturnURL = HttpUtility. UrlEncode (application. Context. Request. Url. AbsolutePath + application. Context. Request. Url. Query);
// ok, now lets redirect to the login page
application. Context. Response. Redirect (loginUrl+"?ReturnUrl="+ ReturnURL);
application. CompleteRequest();
}
}
}

N.B : If the posting is approved with the different instance, the issue was not there!

Monday, April 11, 2005

Installing Sharepoint portal server 2003

I've installed Sharepoint portal server for few times in my machine without any problem and last night I got a strange error while installing (C++ runtime error). After that error it started to uninstall everything (rollback).

STSADM.log-setup* had this line at last - 0 04/11 11:15:04 4240 stsadm: Unknown argument: (password without the problematic character) .

I was not sure about the error in the beginning. After few seconds I figured out that the error was because of the password of the account which I was using it to install sharepoint. After a password change everything went fine.

problematic character -

I tried it few times and figured out that, if this character comes as a first character only this problem occurs.

N.B : I searched the web and Microsoft site regarding this problem. But I couldn't find any results regarding this issue. So I thought its better to have it somewhere posted :) .

Labels:

Saturday, April 02, 2005

How to... in MCMS Manager

I've added help with MCMS Manager, which will be really useful when using the tool. It includes an Introduction and few how to... They are,

-Start MCMS Manager
-Edit postings
-Edit properties of postings
-Release ownership of a posting
-Browse through postings
-Search for postings
-Generate Report