Anthem.net fix for GetAnthemManagerKey

by fred on June 12, 2007

in Code

Change GetAnthemManagerKey in Manager.cs to the following to fix the problem with the page handler changing during ajax callback.

 

Old Code:

private static string GetAnthemManagerKey() {
Page page = HttpContext.Current.Handler as Page;
if (page == null) {
return "Anthem.Manager.Handler";
}
else {
return "Anthem.Manager." + page.ToString();
}
}

New Code:

private static string GetAnthemManagerKey() {
if (_managerKey.Length > 0) {
return _managerKey;
}
else {
foreach (object item in HttpContext.Current.Items) {
if (item is Anthem.Manager)
_managerKey = item.ToString();
}
}
if (_managerKey.Length == 0) {
Page page = HttpContext.Current.Handler as Page;
if (page == null) {
_managerKey = "Anthem.Manager.Handler";
}
else {
_managerKey = "Anthem.Manager." + page.ToString();
}
}
return _managerKey;
}

Related posts:

  1. How to Dynamically Create Images Ask any ASP developer who has ever tried to dynamically create his own images and he’ll tell you it’s a...
  2. Make Gmail delete the current message and open the next one Gmail is great and their keyboard shortcuts help out quite a bit, but it was missing the ability to delete...
  3. The Secrets to Uploading Files with Ease In the golden, olden days of ASP, managing a file upload was pretty difficult. Most developers reverted to digging deep...
  4. Asp.net HTML Color Names On this page you will find a table of color names that are supported by most browsers. ...

Comments on this entry are closed.

Previous post:

Next post: