September 2003 - Posts

Lots of Good Links for Avalon, Indigo, Longhorn, and More...

Lots of great links here: http://dotnetjunkies.com/weblog/unknownreference/posts/1943.aspx

<quote>
Lots and lots of work lately and barely finding time to keep up with what's happening ... that too with PDC coming along, the amount of information that's been circling around on Avalon, Indigo, Longhorn has been mind blowing ... Lots of good articles and blog entries have also been posted lately.. Here are some of them ..
</quote>

MSN 6.0 Images and My New Image Gallery

With MSN 6.0 came the ability to have images so people can see you while your chatting. Well this made me go back in my archive of pictures to find good ones to use. As I was going through them I found that I have pretty amazing pictures so I'm going to start posting them as I use them. I'll probably post a new one every week. You can see my first one here: http://dotnetjunkies.com/weblog/donnymack/gallery/image/86.aspx - now just because I have a party favor in my hand doesn't mean I had anything to do with this very unpleasant moment.

Here is also a picture of me in Saudi: http://dotnetjunkies.com/weblog/donnymack/gallery/image/87.aspx - I know it might seem funny that I'm dressed the same and have the same expression - but that's just how I am.

Full Gallery: http://dotnetjunkies.com/weblog/donnymack/gallery/364.aspx

More coming soon!

Creating a Base Page Class? Read this First!

The ASP.NET Page Object Model

One Day in the Life of an ASP.NET Web Page

Dino Esposito
Wintellect

August, 2003

Applies to:Microsoft® ASP.NET

Summary: Learn about the eventing model built around ASP.NET Web pages and the various stages that a Web page experiences on its way to HTML. The ASP.NET HTTP runtime governs the pipeline of objects that transform the requested URL into a living instance of a page class first, and into plain HTML text next. Discover the events that characterize the lifecycle of a page and how control and page authors can intervene to alter the standard behavior. (6 printed pages)

http://msdn.microsoft.com/asp.net/?pull=/library/en-us/dnaspp/html/aspnet-pageobjectmodel.asp#aspnet-pageobjectmodel_topic2

Finally Enabled HTTP Compression in IIS 6.0. Here's How I Did it!

Here are the steps to enable GZIP compression in IIS 6.0.

First Go here: http://dotnetjunkies.com/weblog/donnymack/posts/876.aspx  - Make sure to follow the instructions to the T.

In the final step you're going to be editing the metabase.xml file (IIS 6.0 Metabase) BACKUP FIRST. I was interested in finding out all the properties here and this is what I found. First, the entry for GZIP compression:

<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"
  HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
  HcCreateFlags="1"
  HcDoDynamicCompression="TRUE"
  HcDoOnDemandCompression="TRUE"
  HcDoStaticCompression="TRUE"
  HcDynamicCompressionLevel="10"
  HcFileExtensions="htm
   html
   txt"
  HcOnDemandCompLevel="10"
  HcPriority="1"
  HcScriptFileExtensions="asp
   dll
   exe
   aspx"
 >
</IIsCompressionScheme>

I'll just go over some of the attributes I found useful.

  • HcDoDynamicCompression: Specifies whether dynamic content should be compressed.
    important Important  Because dynamic content is by definition always changing, IIS does not cache compressed versions of dynamic output. Thus, if dynamic compression is enabled, each request for dynamic content causes the content to be compressed. Dynamic compression consumes considerable CPU time and memory resources, and should only be used on servers that have slow network connections, but CPU time to spare.
  • HcDoStaticCompression: Secifies wheter static content should be compressed
  • HcDoOnDemandCompression: specifies whether static files, such as .htm and .txt files, are compressed if a compressed version of the file does not exist. If set to true and a file doesn't exist the user will be sent an uncompressed file while a background thread creates a compressed version for the next request.
  • HcDynamicCompressionLevel: VAL(1-10) specifies the compression level for the compression scheme, when the scheme is compressing dynamic content. Low compression levels produce slightly larger compressed files, but with lower overall impact on CPU and memory resources. Higher compression levels generally result in smaller compressed files, but with higher CPU and memory usage.
  • HcFileExtensions: indicates which file name extensions are supported by the compression scheme. Only static files with the specified file extensions are compressed by IIS. If this setting is empty, no static files are compressed.
  • HcScriptFileExtensions: indicates which file name extensions are supported by the compression scheme. The output from dynamic files with the file extensions specified in this property are compressed by IIS.

More Information on these settings and others: http://msdn.microsoft.com/library/en-us/iisref/htm/AlphabeticMetabasePropertyList.asp?frame=true#H - if this doesn't bring you to the H section - that's where you'll find everything.

 

SQL Server Blogs

Hello All,

The first thing I wanted to do was announce that we have a great new blogger on SqlJunkies Blogs: Euan Garden - he will be posting on:

General: Stuff like this, personal musings and observations.
Microsoft: General stuff about what we are doing at MS and MS Products.
PDC: I'm going to be at PDC to work the booth etc and also speak at a user group meeting.
SQL Server: Hopefully I can add some info on this
Yukon: As long as the marketing folks don't strangle me I want to provide regular updates on Yukon, based primarily around the 3 sessions that we presented at different TechEds this year.

http://sqljunkies.com/weblog/euang/posts/211.aspx

Among other things.

For those who aren't following what we have been up to over the past month let me give you a quick rundown and then I have a blog related question. First, we have been working on redoing our entire framework. We realized we launched DNJ a bit quickly and were forced to fix a lot of bugs while the site was live. At some point around 2 months ago we realized ths and stopped bug fixes (except major ones) and decided to redo the underlying framework and re-release with a lock solid framework. Another reason why we did this is because we're starting a new site http://www.SqlJunkies.com dedicated to SQL Server and we wanted to use the same framework. Now don't get scared that we'll neglect one or the other sites because we've actually now aquired 2 new people (you probably know them) to work with us on making sure there is content up daily on both sites so the sites are actually going to be a better resource with more content.

So the question regarding the blogs. We're seeing a log of SQL content going up on DNJ and we're wondering if we should bring that content over to SQLJunkies? And if so how?

One thought is combining the main feeds for the sites and having three main feeds:

1. DNJ
2. SQL
3. DNJ/SQL

What do you think?

Buffer Overrun In RPCSS Service Could Allow Code Execution (824146)

A security issue has been identified that could allow an attacker to remotely compromise a computer running Microsoft® Windows® and gain complete control over it. You can help protect your computer by installing this update from Microsoft.

Fix it here: http://www.microsoft.com/security/security_bulletins/ms03-039.asp

Response Filter to Take out White Spaces and New Line Feeds using HttpResponse.Filter

I wanted to make a quick way to make every page of our new sites smaller. I was thinking we'll have to start formatting all of our HTML but that would make it nearly unreadable for us to develop with and then I remembered the Filter property of the HttpResponse object so I started investigating and found this article http://www.aspalliance.com/robertb/articles.aspx?articleId=6&print=true by Robert Boedigheimer and I was on my way.

Here is what I came up with to take out all tabs and new line feeds. After testing pages were definately smaller and rendering was quicker. If someone has a better way please let me know:

Implementation

Implementation is done application wide in my base page class' OnInit method which all webforms inherit from:

this

.Response.Filter = new Base.ResponseFilter(Response.Filter);

Response Filter Class File

using System.Text;
using System;
using System.Text.RegularExpressions;
using System.IO;

namespace CodeJunkies.Base {

 public class ResponseFilter : Stream {
 
  #region properties
 
  Stream responseStream;
  long position;
  StringBuilder html = new StringBuilder();
 
  #endregion
 
  #region constructor

  public ResponseFilter(Stream inputStream) {
 
   responseStream = inputStream;
 
  }
 
  #endregion

  #region implemented abstract members
 
  public override bool CanRead {
   get { return true; }
  }

  public override bool CanSeek {
   get { return true; }
  }

  public override bool CanWrite {
   get { return true; }
  }

  public override void Close() {
   responseStream.Close();
  }

  public override void Flush() {
   responseStream.Flush();
  }
 
  public override long Length {
   get { return 0; }
  }

  public override long Position {
   get { return position; }
   set { position = value; }
  }

  public override long Seek(long offset, System.IO.SeekOrigin direction) {
   return responseStream.Seek(offset, direction);
  }

  public override void SetLength(long length) {
   responseStream.SetLength(length);
  }

  public override int Read(byte[] buffer, int offset, int count) {
   return responseStream.Read(buffer, offset, count);
  }
 
  #endregion

  #region write method
 
  public override void Write(byte[] buffer, int offset, int count) {
 
   // string version of the buffer
   string sBuffer = System.Text.UTF8Encoding.UTF8.GetString(buffer, offset, count);

   // end of the HTML file
   Regex oEndFile = new Regex("</html>", RegexOptions.IgnoreCase);
   if (oEndFile.IsMatch(sBuffer)) {
   
    // Append the last buffer of data
    html.Append(sBuffer);
   
    string tempResponse = html.ToString();
  
     string newBuffer = Regex.Replace(tempResponse, "\t", string.Empty );
     newBuffer = Regex.Replace(newBuffer, "\n", string.Empty );
     newBuffer = Regex.Replace(newBuffer, "\r", string.Empty );
     newBuffer = Regex.Replace(newBuffer, "<!--", "<!-- \n" );
     newBuffer = Regex.Replace(newBuffer, "// -->", "// --> \n" );
     
     tempResponse = newBuffer;
  
    byte[] data = System.Text.UTF8Encoding.UTF8.GetBytes(tempResponse);
   
    responseStream.Write(data, 0, data.Length);
  
   }
   else {
    html.Append(sBuffer);
   }
  
   }
  
   #endregion
  
  }
 }