Scott Hanselman

"Attaching a CacheDependancy to a ASP.NET Page using Output Caching" or "I can't believe they didn't think of this...oh sweet, they did!"

February 19, '03 Comments [2] Posted in Web Services | ASP.NET
Sponsored By

ASP.NET caching This seems like an obvious thing to want to do, but I can't see how. I have a bunch of pages using OutputCaching, like <%@ OutputCache Duration="600" VaryByParam="none" %> but the pages use additional data points / files that I'd like to add as additional cache dependencies. I can create the extra CacheDependency objects, but can't see how to connect them up to the cache entry for the page. I can't beleive the ASP.NET guys didn't think of this.[Simon Fell]

Simon is looking to add a CacheDependancy to a ASP.NET Page using Output Caching, he'll need to use HttpResponse.AddCacheItemDependency and HttpResponse.AddCacheItemDependencies

The most interesting thing about what Simon says is "I can't believe the ASP.NET guys didn't think of this."  That's funny, because I know as well as anyone that the Microsoft guys aren't perfect, but when it comes to the .NET Framework, I'll tend to search just a little harder on the faith that what I need HAS to be there...because they must have thought about this.  As you spend time with the .NET Framework you'll increasingly get that same attitude; they really did think this thing through.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Undocumented configuration setting for XmlSerializer - and a new question emerges?

February 19, '03 Comments [0] Posted in Web Services | ASP.NET | XmlSerializer
Sponsored By

Doug Purdy inspired the crowd just to test (if there were such a possible setting) what would happen if you do this here in an application which uses XmlSerializer.
Very cool! If you do not want to try it out by yourself then I would recommend to download this little
test program ;-)
[Christian Weyer]

Now that's COOL.  Nice to get that insight into what's going on inside the XmlSerializer. 

<sidenote>Recognize that filenaming style?  "qhtozc7m.0.cs" and "qhtozc7m.cmdline"?  You may have seen it in c:/WINDOWS/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files.  (If you haven't, go look!</sidenote>

So, now my question to the people is, what .NET Framework subsystem is managing all those temporary files, lifetime, naming, launching csc.exe, etc, for this kind of compilation? CodeDOM? Don't think so...

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Kent Sharkey in the heezy fo' sheezy babay!

February 19, '03 Comments [0] Posted in Web Services | XML
Sponsored By

Kent Sharkey in the heezy! RSS Subscribed. 

And you know he's a nice guy since his Googlisms are:

kent sharkey is an mcsd
kent sharkey is the soap evangelist and is learning a fear of my camera and me
kent sharkey is the technical evangelist

 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Snazzy tool to the rescue: TaskManagerEx (The

February 19, '03 Comments [0] Posted in Web Services
Sponsored By

In an attempt to find a quickie utility to force open files to close under Windows I stumbled upon TaskManagerEx that extends the Windows Task Manager with such yummy features as:

  • Use different color for services
  • Find a used file by any process. (Use * as file name for showing every used file)
  • Find a used module by any process
  • Use different color for processes if the CPU usage reaches a given limit ( 25%, 50%, 75% )
  • Query list of every files, handles, modules, windows used by a given process
  • Close a used file (you can unlock an exclusively opened file, so you can delete it)
  • Unload a used module (so you can delete it)
  • You can kill services too
  • Fast end process. Press DEL key!

    Needless to say, this baby goes in Startup and C:/UTILS!

  • About Scott

    Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

    facebook twitter subscribe
    About   Newsletter
    Sponsored By
    Hosting By
    Dedicated Windows Server Hosting by SherWeb

    Sairama's Interesting Code of the Day - Printing Line Numbers while Debugging C#

    February 19, '03 Comments [1] Posted in Web Services
    Sponsored By

    In C++ if problems happen, we'll want to log the error along with filename and Line Numbers, often like:

    CString strCompleteMessage;
    strCompleteMessage.Format(_T("%s , HRESULT %0x [%s,%d]"),strMessage,hr,A2W(__FILE__),__LINE__);
    LogInfo(strCompleteMessage);

    In C#, there are no such macros so we use the StackFrame class. Below we show how to print the filename and line numbers while logging messages/errors.

         public static void foo()
         {
         // some operations here
         // some error here
         string msg = "Unable to do xyz operation, Please report this to abc@xyz.com";

         // true means get the file information also ( needs pdb files which can be generated for Release builds )

         StackFrame CallStack = new StackFrame(0, true);
         Console.WriteLine("Error:{0} occurred in:{1} in File: {2} at Line: {3}", msg, CallStack.GetMethod(), CallStack.GetFileName(), CallStack.GetFileLineNumber() );
    }

    About Scott

    Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

    facebook twitter subscribe
    About   Newsletter
    Sponsored By
    Hosting By
    Dedicated Windows Server Hosting by SherWeb

    Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.