MSDN Blog Postings

via RSS Feed

Archive for the 'MSDN Blogs' Category

Backwards compatibility and and preserving search engine ranking

Posted by on 3rd September 2010

Phew – that was a long title! This is a follow-up to a post that my colleague Josh wrote recently. I started typing a comment in response to one of the comments and it got a little bit cramped in the text box so I decided to post it here instead.

To summarise, Josh is looking into migrating the blog engine for his site to ASP.NET MVC and since he’s now running on IIS 7 wants to take advantage of extension-less URLs. His post talks about how to get routes working for both http://www.thejoyofcode.com/{PostLinkTitle}.aspx and http://www.thejoyofcode.com/{PostLinkTitle} using a route constraint to ensure that the latter doesn’t cause a match that includes the “.aspx” in the link title. Commenter valhallasw rightly points out that this approach will lead to splitting of the search engine ranking for pages as search engines will see these as two separate pages. An alternative is to issue a redirect from the old url to the new one, but how?

Well, one approach would be to do this at the IIS level, e.g. URL Rewrite. This is a valid approach and will perform the redirect nice and early in the request handling. But what if you don’t want to use it (or can’t for some reason)?

Rab commented that you could deal with this in the action method – the only change I’d suggest is to create a PermanentRedirectResult and return this as it simplifies testing (the good news is that this is coming in ASP.NET MVC 3, along with a RedirectToActionPermanent helper method!).

Another approach is to handle this directly in the routing. Phil Haack has a discussion of this approach that allows you to do something like routes.RedirectPermanently("home/{foo}.aspx", "~/home/{foo}")

All that’s left is to work out which approach works best for you :-)


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Windows Identity Foundation Samples–HTTP Watch Is Your Friend

Posted by on 3rd September 2010

Continuing my prior post on working with the WIF samples, the WIF samples that come with the SDK, or the labs in the WIF training kit are great learning experiences. To better understand better what is going on under-the-covers, or to troubleshoot problems, using HTTP Watch is a great tool to see the passive WS-Federation traffic from the relying party side. HTTP Watch can capture requests/responses when both the STS and the Replying Party (RP) are hosted in the same localhost web site, something…(read more)
This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Analyzing Database Roundtrips with SQL Server Profiler

Posted by on 3rd September 2010

One of the “good habits” I’ve developed over the years while creating applications is scrutinizing the interaction between logical or physical tiers. Given the nature of solutions that I’m typically involved with, this often involves examining how many roundtrips are required to the database in order to render a single Web page on a site.

In my experience, poorly performing Web applications are most often due to excessive “chattiness” between the Web server and the database.

My general rule of thumb is the time required for each of the following operations differs by at least one order of magnitude from one to the next:

  1. In-memory operations (e.g. finding an object in a Hashtable)
  2. Operations that require disk I/O (e.g. reading/writing a file)
  3. Fetching data from a database
  4. Calling an external Web service

Consequently, if a Web application typically require dozens of roundtrips to the database in order to render a page (and that page is frequently accessed by users), then scalability could certainly be a challenge.

However, trying to identify each database operation  simply by looking at the code is often a futile exercise. This is especially true when building upon frameworks and APIs — such as object-relational mappers or the SharePoint object model — particularly when you consider things like “lazy loading.”

Instead, I prefer to go straight to the source when identifying the number of database roundtrips. Using SQL Server Profiler, you can quickly — and reliably — determine the level of “chattiness” between your application and the backend database.

Note that the Standard template selected by default in SQL Server Profiler specifies to trace the following events:

  • Security Audit
    • Audit Login
    • Audit Logout
  • Sessions
    • ExistingConnection
  • Stored Procedures
    • RPC:Completed
  • TSQL
    • SQL:BatchCompleted
    • SQL:BatchStarting

To identify database roundtrips from an application, I reduce the list of events to the following:

  • Stored Procedures
    • RPC:Completed
  • TSQL
    • SQL:BatchCompleted

I also add the following column filter in order to exclude the “noise” associated with connection pooling:

  • TextData Not Like exec sp_reset_connection%

When analyzing a SharePoint solution, I also add column filters to isolate (as much as possible) the SQL calls initiated by the request for a Web page — as opposed to, say, those triggered by one of the many SharePoint timer jobs.

Once I’ve configured the trace, I clear the trace window and then refresh the browser page. I can then see how many database roundtrips are required to render the page simply by looking at the number of rows in SQL Server Profiler (shown in the status bar in the lower right corner). I can then switch between SQL Server Profiler (to clear the trace window again) and the browser to quickly identify which pages require a large number of roundtrips to the database.

When analyzing custom ASP.NET applications, I also like to look at page requests from a “cold start” of the Web application (i.e. after an IIS reset or recycle of the app pool) in order to understand the “warm-up” time for the application when data is fetched from the database and cached for subsequent use.

Provided you have access to the source code for the solution, you can use techniques like batching multiple SELECT statements into a single database roundtrip (or returning multiple result sets from a stored procedure) in order to significantly improve the performance of your application.

Even if you don’t have access to the entire source code for your solution (e.g. your solution is built on top of SharePoint or some other API) there are often ways you can optimize in order to reduce database roundtrips. I’ll cover a SharePoint-specific example in my next post.


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Fortnightly MSDN Flash poll

Posted by on 3rd September 2010

Last fortnight’s results proved you’re all mad for pizza during late night coding sessions. This fortnight we’ve gone all sensible and I’d like to know which Visual Studio add-ins you use the most.

Technorati Tags:


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Update on the Windows Azure Platform online conference on the 20th of September

Posted by on 3rd September 2010

At the start of August I made a call for speakers for a multi track online conference on the Windows Azure Platform (which resulted in a great bunch of speakers stepping forward!). However at the end of August I changed job and I am no longer pulling this conference together – that role falls on the shoulders of my replacement Steve (actually I was replaced with Steve and Martin – I always knew I was worth two evangelists if only in weight!) The conference is still going ahead but Steve and Alex…(read more)
This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Tutorials zu Silverlight: Animierte Silverlight-Buttons im Glass-Look mit Expression Blend

Posted by on 3rd September 2010

Der relativ neue Blog SCREENBOMB hat bereits verschiedene sehr interessante Tutorials zu Silverlight und Expression Blend veröffentlicht.

image

In diesem Beitrag Erklärt der Autor Thorsten Schneyer sehr anschaulich wie sich der beliebte Glass Look in Silverlight Projekten mit Hilfe von Expression Blend umsetzen lässt.

In jedem Fall interessanter Lesestoff und damit sei Ihnen dieser Blog sehr ans Herzen gelegt.


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Download Family Safety Brochure

Posted by on 3rd September 2010

Spotted this great 2 pager on Family Safety covering the whole range of Microsoft products from Windows Live to XBox Live, Zune and Windows Media Center

Download Family Safety Brochure

Download details: Family Safety Brochure

If you want to learn more on these subjects try these resources.

Rob


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Twitter Notify plugin for Windows Live Writer updated

Posted by on 3rd September 2010

Twitter NotifyJust  a quick to note that the Twitter Notify plugin for Windows Live Writer has been updated so it now works with the new Twitter authentication changes…

If you use Windows Live Writer and Twitter this is the one for you…

 

Rob


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

MSDN Flash Poll #7 – Visual Studio Add-Ins

Posted by on 3rd September 2010

This time around we want to know about your favourite / most used Visual Studio add-in. I can’t include them all so if your favourite isn’t here, be sure to add a comment to this post to let the world know. Otherwise, Visual Studio extensions, prepare to do battle……(read more)
This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off

Tech Fielders セミナーで ASP.NET MVC を知ろう!学ぼう!

Posted by on 3rd September 2010

Tech・Ed 2010 Japan が終わったのもつかの間、ASP.NET MVC のさらなる情報をみなさんにお伝えするべく、下記セミナーの開催が決定しました。

Tech Fielders セミナー 東京
『 知ろう!学ぼう! ASP.NET MVC ~ 最新 Web 開発フレームワークの全体像 ~ 』

2010 年 10 月 1 日 18:45 – 20:45 (受付開始時間: 18:15)

お申込み&詳細はこちら:
https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032459368&Culture=ja-JP

今回もみなさんがご参加しやすい時間でということで、18:45 – 20:45 のナイトセミナーとしました。場所はいつもの マイクロソフト 新宿本社 5F セミナールームです。

なぜか私一人でしゃべらなければならなくなってしまったのですが、先日の Tech・Ed 2010 の ASP.NET MVC セッションをもう少し幅広い方々にお楽しみいただけるよう構成する予定です。時間があれば、Edtter のライブコーディングなどもご覧いただければいいなぁ、などと思っています。予定は未定ですが、こうご期待!!

Twitter で、このセミナーについてつぶやいたところ、東京以外での開催を希望される方々が多くいらっしゃいました。残念ながら今回は東京以外での開催は未定なのですが、みなさまが参加されているコミュニティや職場を通してご依頼いただければ、お伺いすることも可能かも??しれません。(北の方とか南の方に行きたいなぁ・・・なんて♪)

では~


This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.

Posted in MSDN Blogs | Comments Off