Display QueryString and Form its on Page

I know this probably is one of the most common posts out on the web (for .Net coders), but I can never seem to find it when I need it. So it is here for my reference.

When you are trying to debug an ASP.Net page and you need to see the form collection after a POST or the QueryString (for convenience) for a GET or POST, simply copy the method add it to a page and call it from one of the Page Lifecycle Event Handlers, such as OnInit, OnLoad, etc. I think it is poor practice to hide this output in the body of a page as a comment so I am not doing that (and strongly recommend that you don’t do that either) … simply remove the code or call (if you add it to a library as a static method). I have seen too many people leave the output as commented (html) code … simply bad.

Nonetheless, here is the code snippet:

/// Display the QueryString Collection and Form Collection information for a ASP.Net Page

private void RenderRequestInfo() {

//Iterate the Request.QueryString collection
Page.Response.Write(string.Format(“ Request.QueryString ({0})
“, Page.Request.QueryString.Count.ToString()));
foreach (string queryItem in Page.Request.QueryString) {
try {
Page.Response.Write(“='” + HttpUtility.HtmlEncode(Page.Request.QueryString[queryItem]) + “‘
} catch (Exception ex) {
Page.Response.Write(string.Format(“=[Error during render.] {0}
“, ex.Message));

//Iterate the Request.Form collection
Page.Response.Write(string.Format(“ Request.Form ({0})
“, Page.Request.Form.Count.ToString()));
foreach (string formItem in Page.Request.Form) {
try {
Page.Response.Write(“='” + HttpUtility.HtmlEncode(Page.Request.Form[formItem]) + “‘
} catch (Exception ex) {
Page.Response.Write(string.Format(“=[Error during render.] {0}
“, ex.Message));


Rename a WSS3/MOSS Server

I took this from Mirjams blog. I have verified that it works. I am adding it here so that I can find it when I need it, and as I mentioned, it works great.

Renaming a WSS3 or MOSS server requires very specific tasks in a specific order. If you don’t follow the following instructions precisely, the chances are that you may need to reconfigure your whole MOSS environment.

Here are the steps to take, and the order in which to take them if you want to rename a server that has WSS3 or MOSS already installed and configured on it:

*** NOTE: Use only letters, digits and minus for the machine name (so no underscores), max 15 characters.


  1. Change each alternate access mapping for your WSS3 or MOSS deployment in Central Administration:
    1. Open Central Administration, “Operations” Tab, “Alternate access mappings” link
    2. Modify each mapping item to reflect your newly chosen server name
  2. Use stsadm.exe to invoke the “renameserver” command option:
    1. Open a command prompt window
    2. cd “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN”
    3. stsadm -o renameserver -newservername -oldservername
  3. Rename your Server via Change Name Operation in Windows Server 2003:
    1. Start Menu | Control Panel | System, “Computer Name” tab, “Change” button.
    2. Input your new server name
  4. Reboot the server NOW.
  5. Update the MOSS farm creadentials
    1. After reboot, open command prompt
    2. cd C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN
    3. stsadm -o updatefarmcredentials -userlogin -password
  6. iisreset /noforce
  7. Check all application pool identities in IIS, update where the old machine name is still there.
  8. If you already have a search index drop this, and rebuild it
  9. Congratulations, your server is now renamed.


Useful MOSS Tools

Below, I am making a list of the tools I use most frequently for MOSS development, diagnosis and some maintainance.

SharePoint Manager 2007


This tool is a MOSS swiss army knife. It traverses the MOSS object model and displlay the properties for a vast number of MOSS objects. The tool also allows the user to make changes on the spot and commit the changes to MOSS. I can’t emphasize enough how good this tool is.

U2 CAML Tool

This tool makes building and testing CAML queries a simple task. It connects to MOSS and allows you query build live queries and test them accordingly.

Web Service Studio 2.0

This tool allows you view SharePoint through it web services. I use this tool for verifying data, extracting xml to verify and assimilate MOSS objects. Through it you can invoke webmethods interactively by providing a WSDL endpoint. The tool fetches the WSDL, generates .NET proxy from the WSDL and displays the list of methods available. Then you can invoke any method (with custom input parameters). The SOAP request is sent to the server and the response is displayed in the UI.

WSP Builder

This tool This tool is used for create web solution packages (wsp) from a folder structure. There is also a Visual Studio Add-in which allows you to build a wsp for a project at a time. This tool saves hours of configuration and testing per project. This tool is a must for building SharePoint solutions.

FireBug (for FireFox)


This tool integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. It allows you to explore and modify the document object model (DOM) of a Web page. This includes the styles, style sheets and other resources. The Developer Toolbar can be pinned to the Firefox browser window or floated separately.

IE Developer Toolbar


This tool allows you to explore and modify the document object model (DOM) of a Web page. This includes the styles, style sheets and other resources. The Developer Toolbar can be pinned to the Internet Explorer browser window or floated separately.

I will add more tools as I remember and/or encounter them. I will use the MOSS Tools label.

MOSS 2007 Column Limitations

I recently had a meeting with a client where it was asked if SharePoint 2007 (MOSS) still suffered from the SharePoint 2003 limitations. I began testing and ran into no limitations. I stopped at 190 fields successfully. I also tested the 190 fields with content types, and adding and editing documents using the content type.


In SharePoint 2003, the following limitations were well known (1):

  • 64 Single line of text and Choice (drop-down menu or radio buttons)
  • 31 Multiple lines of text and Choice (check boxes (allow multiple sections))
  • 32 Number and currency
  • 32 Hyperlink
  • 16 Date and time
  • 16 Lookup
  • 16 Yes/No
  • 8 Calculated


I found Microsoft literature specifying the following “guidelines for acceptable performance” for columns (2):

  • 2,000 per document library
  • 4,096 per list

“This is not a hard limit, but you might experience library and list view performance degradation as the number of columns in a document library or list increases.”

I found a blog article where Ishai Sagi tested the performance of creating 2000 text fields. Here is a summary of his findings:

Average time per fields as more fields created

I looked into SharePoint 2007 to figure out exactly how Microsoft overcame the limitations in SharePoint 2003. SharePoint has a table called “AllUserData” where they have the following fields:

  • 8 datetime (DateTime)
  • 12 float (Number, Percentage)
  • 16 int (Integer)
  • 16 bit (Boolean)
  • 32 ntext (Note)
  • 64 nvarchar (Text, Url, Choice)
  • 8 sql_variant

In a nutshell, if the limit of any of the column types is reached, SharePoint uses a second row to begin populating the data. The new row will have a field called rowOrdinal incremented to 1. Therefore, if the column once again exceed their limit, the rowOrdinal will be incremented to 2 and so on.

1 – To read more about the SharePoint 2003 limits: http://support.microsoft.com/default.aspx?scid=kb;en-us;823555

2 – To read more about the SharePoint 2007 (MOSS) limits: http://technet.microsoft.com/en-us/library/cc262787.aspx

3 – To read more about the performance testing of columns: http://www.sharepoint-tips.com/2006/06/sharepoint-2007-column-limits.html

Best Practices: Closing and Disposable of MOSS Objects

Several blogs out there talk about the need to close and/or dispose of the SPSite and SPWeb objects. I took this to heart but then I started receiving the occasional error stating:

“Trying to use an SPWeb object that has been closed or disposed and is no longer valid.”

The purpose of this blog entry is to clear this up (at least for me). The following link is to Microsoft’s documentation on this matter: http://msdn2.microsoft.com/en-us/library/aa973248.aspx

In summary:

  • If you create SPSite object using the “new SPSite()” constructors (any constructor override), then you need to call the “SPSite.Dispose()” method.
  • If you create the SPSite object using SPControl.GetContextSite(), then you should NOT dispose of the object.

This is Microsoft’s explanation as to why you should not dispose of the object when instantiated through using SPControl.GetContextSite():

“Because the SPWeb and SPSite objects keep an internal list that is derived in this way, disposing of the object may cause the SharePoint object model to behave unpredictably. Internally, Windows SharePoint Services enumerates over this list after page completion to dispose of the objects properly.”