Friday, November 7, 2014

Debugging Routes - ASP.NET MVC

After creating Custom Routes, you have to check whether your routes work perfectly with your given URL or not. For that, you have to debug your routes. To Debug Routes, you have to download one DLL from the http://code.haacked.com/mvc-1.0/RouteDebug-Binary.zip and add a reference into your MVC Application.
Now debug route you have to write the following line of the code into the Global.asax Application Start Event.

RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);

And run your application. You will see the below screen in your browser:

RouteTesting.JPG
You can see all the custom routes into All Routes Table and it will show that your browser URL matches with which Routes. If it will match any Routes, it will show true into the Match Current Request Routes, otherwise it will show false. You can check with another URL, for that you have to write URL into the Address Bar.

Saturday, November 1, 2014

A Technique for Maintaining Scroll Position on Postback in ASP.NET 2.0

Page directive supports a feature to maintain scroll position on page PostBack.  As we add the below page directive.






Above code inject JavaScript to return scroll position and also add state to hidden field to remember scroll position.

How asp.net Asynchronous page work?

Please find below video from http://www.pluralsight.com/ for Asynchronous page in asp.net.