Wednesday, July 19, 2006

Microsoft ASP.NET 2.0 Free Training in Phoenix

The trainging was put on by interface technical training at the Microsoft office in Phoenix, AZ. The training was nice, but not that much more impressive than going to www.asp.net and looking at the intro videos. The content was very similar. What made the training great was the presenter (Dan Wahlin) and his tips. Below are the tips that meant something to me personally.

Instructor:

FREE SQL intellisense for Query Analyzer and I think VS Studio 2005 (through Sept) from www.redgate.com. The name of the product is SQL Prompt.

Good resource for XML can be found at www.xmlforasp.net. Check it out.

Good resource for async stuff: www.asyncpostback.com

Free Microsoft Visual Studio 2005 Standard Endition from www.learn2asp.net. You must sign up and take at least three training classes. They are actually pretty nice training videos that you can download and watch at your leisure. There is a limited time on this offer.

Detail View Control

  • ItemTemplate can be used in Detail View to add validators, DropDownList, etc instead of the default textbox.

ASP.Net Architecture

  • JIT deployment - You don't have to deploy all dll's. Can deploy just the source (.cs, .vb, etc) and will be compiled on server. This allows you to make changes on the fly in production, and even treat .cs as a scripted language. The JIT takes care of the compilation on the fly. Nothing like making changes to production. ;)
  • Web.config - Changes to web.config doesn't force application to restart.
  • Access configuration settings - To access configuration settings from .aspx or .ascx page you can use the syntax <%$ section:key %>
  • DataBinder - It now has a method called Eval(). You can also use Bind() for two way binding. You can also use XPath().
  • To access configuration you can use Configuration Manager or Web Configuration Manager.
  • App_offline.htm - If you puta file called App_offline.htm in the app directory the application will no longer accept new users and bleed off old users. This is good if you are putting up a new version and can have down time.
  • The newest SharePoint Portal Server 2003 Service Pack will allow ASP.Net 2.0 web parts to run under SharePoint Portal Server.

Visual Studio 2005 changes

  • Web Deployment Project - See www.asp.net to get "Web Deployment Project" that allows for VS Studio.Net 2003 like projects and build scenario. This will give you the bin directory and allow 1.1 like deployments. ASP.Net 2.0 does not use bin directory by default.
  • Snippets - You can add custom key for code snippets you right. For some reason VB.Net has lots of snippets when you install VS 2005, and C# does. So you have to download them separately.You can download Microsoft authored code snippets from msdn.microsoft.com and community authored snippets from www.gotcodesnippets.com.
  • VB.Net Refactor tool needed - VS 2005 for some reason does not include refactor functionality. They left it to a third party. You can get the quite nice (better than C# one in some cases) from www.shrinkster.com/fwh.

More Free Cool Tools

  • ViewState Decoder - a very cool tool that lets you see what is actually in you viewstate. Get it at www.pluralsight.com. In case you are wondering viewstate is not secure, or encrypted. It is just Base64 encoded.

Great ASP.Net blog

Connection String Encryption

  • use reg_iis with different options -pef and -pdf to encrypt the connection strings in your web.config. The encryption is specific to machine key. You can copy the machine key to decrypt connection string on another machine. You would need to do so if you have a web farm. If you don't only the machine that encrypted the string will be able to decrypt it.

Cross Page Postback

  • You can now post to another page. You can get the values from the page that contains the values you want to submit (called the Previous Page). if (Page.IsCrossPagePostback) { Page.PreviousPage.FindControl("controlName"); }

  • When accessing previous page, you will need to specify the page type. The syntax is something like <% PageType=xxx %>

Some Enhancements

  • Panel can override default button
  • Can set focus to first error on page. See property on Required Field validator to enable. Note: If the error is not in view on the page, the page is NOT scrolled.
  • You can now access Form element using Page.Form syntax.
  • You can now access Head element usingPage.Head syntax.

Detail View Nested Controls Syntax

  • Use $ to reference the custom nested controls. i.e. DetailView1$MyCustomField"
  • Another example is if you changed TextBox to a DropDownList in the DetailView.

Master Page

  • You can have more than one content placeholder for a master page.

SiteMapProvider

  • Override it to read site map from database. To override specify it in the web.config. Jeff Prosey has already done this.
  • Use SiteMapModule VS.Net Macro from Scott Allen to autogen sitemap file based on project files and directories instead of creating the file by hand.
  • Security Trimming - The ability to remove links that the current user does not have permissions to access based on authorization information in web.config.
  • Can have different files that can be referenced in main sitemap file. This would be useful if there is part of the site map that is the responsibility of departments, etc.

Profiles Database

  • The Profile database keeps track of profile information.
  • It is commonly the same as the Membership database.
  • The Profile database can be chnaged in the machine.config to other SQL Servers, including another SQL Server Instance (even on another machine).

Themes

  • Theme for entire site can be set in the web.config. <pages theme="Philips" />
  • The page directive StyleSheetTheme="" will override the setting in the web.config if you want some pages to have a different theme.

Membership

  • The source for MS Membership is now available from Microsoft.