Statistics
Visits: 105082
Page Visits: 139162
Active visitors (monthly): 5364
Feed Count: 45
Most visited page: Adding value as a technical analyst
Archive : Oct 2010

HttpContext.Current.Profile is null

I ran into a problem where HttpContext.Current.Profile is returning null. This was after turning anonymous identification on. After investigation, I found the reason for this was Url rewriting. Using HttpContext.RewritePath caused the Profile module to terminate (or failed to start)


The following change in web.config will ensure that all modules will run irrespective of such events.

<system.webServer><modules runAllManagedModulesForAllRequests="true"><add name="UrlRewrite" type="VijayT.UrlRewrite,VijayT" /></modules></system.webServer>

The attribute runAllManagedModulesForAllRequests should be set to true. This also solved the session problem that I encountered earlier. See previous post.

Permalink | No Comments | Leave your comment
 

Interesting observation on Sessions

A web application loses its SessionModule in the following case:
  • Web application runs on IIS 7 in integrated pipeline mode
  • Web application has few folders that are authorized by forms authentication
  • The remaining Web application has access to unauthenticated users
  • The user moves from the free-for-all zone to authenticated zone and moves back to the free-for-all zone.
  • In this case, the web application does not have access to Session module. Any run-time access to Session object will throw a HttpException. The code if (Session != null) will create exception.
To illustrate the above, consider the web application having a web.config like the below:
<authentication mode="Forms"><forms loginUrl="~/Admin/Login.aspx" defaultUrl="~/Admin/Login.aspx" timeout="30" slidingExpiration="true"><credentials passwordFormat="Clear"></credentials></forms></authentication><authorization><allow users="?" /></authorization>

In the sub-folder - Admin, the web application has a web.config like the below:
<authorization><deny users="?" verbs="*" /></authorization>

When the user moves to Admin folder, and comes back to the main application, access to Session object in the runtime throws HttpException!
Permalink | 1 Comment | Leave your comment
 
Commented by Vijay at 30-Oct-2010 03:12 PM

This issue is resolved by making an adjustment in the web.config. Check the next post for resolution!

New features to the blog

A few new features have been added:

  1. The look and feel of the blog is improved by applying consistent styles
  2. The BlogRoll page gets the latest post from each of the blogs added
  3. The Links page is more informative
  4. The blog now provides a RSS feed

In the backend, several new features are added including RichTextEditor.

Permalink | 1 Comment | Leave your comment
 
Commented by Test at 29-Oct-2010 11:45 AM

Testing this feature

Customizing AJAX HTMLEditor Control

The toolbar buttons in the HTMLEditor control of AJAX Control Toolkit can be customized. For this, create a new server control deriving from HTML Editor and override the FillTopToolbar() method as follows:

public class LiteEditor : Editor
{
    protected override void FillTopToolbar()
    {
        TopToolbar.Buttons.Add(new Bold());
        TopToolbar.Buttons.Add(new Italic());
        TopToolbar.Buttons.Add(new Underline());
        TopToolbar.Buttons.Add(new Paragraph());
        TopToolbar.Buttons.Add(new OrderedList());
        TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.BulletedList());
        TopToolbar.Buttons.Add(new ForeColor());
        TopToolbar.Buttons.Add(new ForeColorSelector());
        TopToolbar.Buttons.Add(new ForeColorClear());
    }

Bold, Italic are pre-defined buttons available within AJAXControlToolkit.HTMLEditor namespace.

Permalink | 2 Comments | Leave your comment
 
Commented by Vijay at 27-Apr-2011 12:16 PM

What I understand is that you want to add your own toolbar button as well as the dialog. For this, you will have to download the source code from Codeplex and do some more tinkering.

Commented by RaVi at 20-Nov-2010 11:09 AM

How can i add my own popup button to the toolbar