Blog entries tagged with Code Samples

Generating Excel reports

by: Johan Olofsson

I guess that we all have had to create some Excel files for doing reports from a web page at one time or another, and one quite common approach is to simply render the data as comma/tab-separated text and then specify some appropriate Response... [ Read full article ]

11 February 2009  2 Comments

StickyTabs for EPiServerCMS5

by: Johan Olofsson

Or: “an exercise in hacking EPiServers Edit mode!”   I’ve always found it a little awkward having to do repetitive tasks spanning more than one page in EPiServer’s Edit mode as the selected tab is reset to the default “View” tab when I click on a... [ Read full article ]

23 September 2008  4 Comments

Some ActiveDirectoryRoleProvider issues

by: Johan Olofsson

There has recently poppep up some issues/questions related to the ActiveDirectoryRoleProvider that we made available for download (including sources), and as I have been somewhat involved in investigating them I thought I should share the results ... [ Read full article ]

18 September 2008  6 Comments

Providing simple "metadata" for Properties

by: Johan Olofsson

Have you ever found the need for being able to specify metadata for EPiServer Property's? For example as in my current situation, developing code that interacts with Microsoft Dynamics CRM, being able to specify what "entity" (Contact, Account,... [ Read full article ]

12 September 2008  1 Comments

Friendly URL with no rebasing

by: Johan Olofsson

I got a question regarding EPiServer CMS friendly url rewriting about wether it is possible to make the rewritten url's relative to the site's root rather than the context of the requested page. If you look at the html source for a page rendered b... [ Read full article ]

01 July 2008  2 Comments

Hack: Faking HttpContext under EPiServer CMS5

by: Johan Olofsson

In my previous posts, I showed how one can "fake" a web request by creating a HttpContext and then assign it to the writeable property HttpContext.Current. Now, there is a problem using this approach under the original release of EPiServer CMS5,... [ Read full article ]

23 June 2008  5 Comments

Hack: Getting the html from a PageData in EPiServer CMS5 Part2

by: Johan Olofsson

Ok, as you found out if you tried to use the html that was generated using the code in the previous post, you'd notice that all links were rendered in the good ol "classic" style: "templates/page.aspx?id=3&language=en" So, how can we fix that when... [ Read full article ]

18 June 2008  0 Comments

Hack: Getting the html from a PageData in EPiServer CMS5

by: Johan Olofsson

I've gotten some requests for sample code showing how to get the resulting html for a EPiServer PageData so I thought I would share some ideas I had around this. The question is: "I have got a PageData instance. Now how can I (server side) get the... [ Read full article ]

18 June 2008  13 Comments

Enum.Parse() is quite useful

by: Johan Olofsson

I sometimes write code that needs to parse user given arguments, for example through settings in configuration files, parameters given on the command line et.c. The usual way I've dealt with them is to simply perform a bunch of string compares in ... [ Read full article ]

18 December 2007  2 Comments

Parsing Active Directory Connection Strings

by: Johan Olofsson

Today I had the need to parse an Active Directory connection string ( LDAP://server/CN=Users,DC=EPiServer,DC=Com ) into its various parts and found the little nifty interface IAdsPathName which does exactly this. By using COM-interop this can be... [ Read full article ]

04 December 2007  0 Comments


"Impersonating users"

by: Johan Olofsson

I sometimes need to run code, especially EPiServer page retrieving/submitting, within a specific user's context, preferrably without having to log them in (and thus having to know and store their password) One approach to this might look something... [ Read full article ]

29 November 2007  2 Comments

PageTreeLoader / PageTreeReader is gone

by: Johan Olofsson

If you (like me) have been using the nifty functions PageTreeLoader / PageTreeReader to load complete hierarchies of pages in EPiServer 4.x, you'll notice that these functions are now gone in EPiServer CMS5 and that EPiServer.Legacy4 suggests that... [ Read full article ]

29 November 2007  1 Comments

EPiTrace logger