Friday, July 16, 2010

Use Fiddler to Debug An ASP.NET Page

If you are using Windows Server 2008 you won't be able to view HTTP response/requests while working with ASP.NET applications that are hosted on LocalHost. To be able to monitor the request/responses that are initiating from your local machine include a "." after the localhost so Instead
http://localhost:4303/Default.aspx
try
http://localhost.:4303/Default.aspx
There is also one option in Fiddler which can cause problems and has to be turned off So in Fiddler goto Tools --> Fiddler Options -->General Tab --> Uncheck "Enable IPv6 (if available)"

An interpretation of "Application Domains" in .NET

An Application Domain is an abstraction of a library/process. .NET provides Application Domains to abstract away the concept of processes from the underlying operating system. We can think of Application Domain as the process/library that is on top of CLR, not the process/library that is on top of the actual operating system. That's what makes .NET, platform independent!

SharePoint Extensibility with Excel Web Services

SharePoint 2007 supports an extensibility mechanism using Web Parts.
ASP.NET Web Part controls are an integrated set of controls for creating Web sites that enable end users to modify the content, appearance, and behavior of Web pages directly in a browser.
Excel Services is part of Microsoft Office SharePoint Server 2007 which is built on ASP.NET and Windows SharePoint 3.0 technologies. Using Excel Web Services we can create Web Parts which can be dropped into SharePoint and add custom functionality into it. More Here Using Excel Web Services in a SharePoint Web Part

"Run As Administrator" From the command line

Both Vista And Server 2008 emphasize on using "Run As..." option to provide a more secure environment. For those that are interested in using the command-line it might be annoying to right click on each application that they want to "Run as Administrator" especially for developers. Here is the sequence to get the applications "Run as Administrator" (I used to create a shortcut for the application and in the "Advanced" options of the shortcut properties check the "Run As Administrator") Press Windows button, in the immediate text box that appears type the name of the application that you want to run e.g. cmd, then instead of pressing Enter, press Ctrl+Shift+Enter which might ask you to provide user-name password but then you can save it. Do not overuse this option, things like internet explorer (iexplore) don't need to be run as an admin.

How to Open an MDF file!

That might be wrong to ask "how to open an MDF file". Although the data comes as a file, DB engine needs extra information while opening this file which comes with other files including the log information. So when we use Microsoft SQL Server Express the right way to say that is to "Attach to an MDF file"

Bind a DropDownList in ASP.NET to an enum

It is quite common to bind a DropDown control in an ASP.NET page to an Enum. the right syntax is
 ddlWeekDays.DataSource = Enum.GetNames(typeof(EnumWeekDays)); ddlWeekDays.DataBind();

iFrame in an ASP.NET page

iFrame controls are standard HTML controls and are not available as an ASP.NET object in the code behind file. If you want to access this object the only way to do that is to find the control and set the attributes of the control manually For example if the control is named myIFrame in the HTML file in a code-behind event handler we can get a hold on the control by calling
 HtmlControl myCodeBehindAcceddToIFrame = (HtmlContrl)this.FindControl(myIFrame); 
To set one of its attributes we can make a call similar to
 myCodeBehindAcceddToIFrame.Attributes["src"] = "…new url..."