<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Stephen Wright : ASP.NET</title><link>http://devlicio.us/blogs/steve_wright/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>ASP.NET + StructureMap = Epic Win</title><link>http://devlicio.us/blogs/steve_wright/archive/2009/11/25/asp-net-structuremap-epic-win.aspx</link><pubDate>Thu, 26 Nov 2009 04:51:03 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54138</guid><dc:creator>Stephen Wright</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/steve_wright/rsscomments.aspx?PostID=54138</wfw:commentRss><comments>http://devlicio.us/blogs/steve_wright/archive/2009/11/25/asp-net-structuremap-epic-win.aspx#comments</comments><description>&lt;p&gt;After running into a lot of testing problems with my current architecture in ASP.NET, I decided that it was time to look into an IoC Framework.&amp;#160; I have heard the marvels of how it makes code so much more isolated and clean (SOLID), but I couldn’t see my code ever getting to this point.&amp;#160; Because this project has a ton of legacy code, there was little incentive to add anything else when it was already so highly coupled.&amp;#160; I needed to take a step back and look at it from a different perspective.&lt;/p&gt;  &lt;p&gt;I understood how IoC (Inversion of Control) Frameworks worked and knew how this technique is used, but I didn’t know how I could integrate it in my application.&amp;#160; Most of my action/service methods were static classes that instantiated new objects to return what I needed.&lt;/p&gt;  &lt;p&gt;Here’s an example:&lt;/p&gt;  &lt;p&gt;On the member page, there is a list of upcoming conferences that calls this code:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:dd8e0eb7-bfc4-40a2-9e1a-3a86746397ff" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="vb"&gt;Public Class ConferenceService    

	Public Shared Function GetUpcomingConferences(ByVal DisplayDate As DateTime) As IList(Of ConferenceEntity)        
		Using repo As New Repository            
			Dim bucket As New RelationPredicateBucket(ConferenceFields.IsActive = True)
            Dim startfilter As New PredicateExpression(ConferenceFields.StartDisplayDate = System.DBNull.Value)            
			startfilter.AddWithOr(ConferenceFields.StartDisplayDate &amp;lt;= DisplayDate)    
			bucket.PredicateExpression.AddWithAnd(startfilter)         

			Dim endfilter As New PredicateExpression(ConferenceFields.EndDisplayDate = System.DBNull.Value)   
			endfilter.AddWithOr(ConferenceFields.EndDisplayDate &amp;gt;= DisplayDate)           
			bucket.PredicateExpression.AddWithAnd(endfilter)          
			Dim sorter As New SortExpression(ConferenceFields.StartDateTimeUtc Or SortOperator.Ascending)    
			Return repo.GetCollection(Of ConferenceEntity)(bucket, sorter).ToList()    
		End Using   
	End Function
	
End Class&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I am using LLBLGen (Adapter) as my DAL so the Repository class is responsible for calling a new object to create what LLBLGen calls an EntityCollection.&amp;#160; This is easy to call because all I have to do is call ConferenceService.GetUpcomingConferences(Date.Now()) to get a list of upcoming conference.&amp;#160; This is very hard to test though without using something like Typemock.&lt;/p&gt;

&lt;p&gt;In order to start my refactoring to be able to integrate StructureMap, I needed to look at how my ConferenceService was being constructed.&amp;#160; There are 5 constructor calls in this method alone. You can imagine how the rest of the application looks like.&lt;/p&gt;

&lt;h3&gt;Adding and Setting Up StructureMap&lt;/h3&gt;

&lt;p&gt;First, download StructureMap from the website.&amp;#160; I downloaded version 2.5.3.&amp;#160; Next was to look how to get StructureMap set up on the web project (found here &lt;a title="http://structuremap.sourceforge.net/ConfiguringStructureMap.htm" href="http://structuremap.sourceforge.net/ConfiguringStructureMap.htm"&gt;http://structuremap.sourceforge.net/ConfiguringStructureMap.htm&lt;/a&gt;).&amp;#160; I had to use for VB and lambdas are tricky so this is how the Bootstrapper was defined:&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:312acba2-65a4-4d31-ab1f-e9a77644cf45" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="vb"&gt;Imports StructureMap
Imports StructureMap.Configuration.DSL

Public Class Bootstrapper    
	
	Public Shared Sub BootstrapStructureMap()        
		ObjectFactory.Initialize(AddressOf ConfigStructureMap)    
	End Sub    

	Private Shared Sub ConfigStructureMap(ByVal x As IInitializationExpression)        
		x.AddRegistry(New RepositoryRegistry)    
	End Sub    
	
	Public Class RepositoryRegistry       
		Inherits Registry        
		
		Overrides Protected Sub configure()   
			&amp;#39;Will be used later after we refactor      
			&amp;#39;ForRequestedType(Of IRepository)().TheDefaultIsConcreteType(Of Repository)().CacheBy(Attributes.InstanceScope.Hybrid)   
		End Sub   
		
	 End Class
 End Class&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And then, in our Global.asax, on the Application_Start, call the Bootstrapper.BootstrapStructureMap() method. That is all we need for StructureMap config for now.&amp;#160; That will get us started in the right direction.&lt;/p&gt;

&lt;h3&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" border="0" alt="image" align="right" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/steve_5F00_wright/image_5F00_47823835.png" width="349" height="168" /&gt;Refactoring&lt;/h3&gt;

&lt;p&gt;The first refactoring is to Extract an Interface from the Repository class.&amp;#160; If you have a refactoring tool such as Refactor Pro! or Resharper, this is made very easy.&amp;#160; I called mine, &lt;strong&gt;IRepository&lt;/strong&gt;.&amp;#160; This will make the Repository class implement the newly created interface.&amp;#160; We can now start on the ConferenceService.&lt;/p&gt;

&lt;p&gt;The next refactoring is to create a constructor for the ConferenceService class that takes an IRepository as a parameter.&amp;#160; This will help us create Constructor Injection.&lt;/p&gt;

&lt;p&gt;After we add the parameter, we can remove the code that uses the concrete Repository object.&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:911bc65d-9db6-49a3-9ee0-90eaadcc3999" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="vb"&gt; Public Class ConferenceService   
	 
	 Private _repo As IRepository    
	 &amp;#39;&amp;#39;&amp;#39; &amp;lt;summary&amp;gt;    
	 &amp;#39;&amp;#39;&amp;#39; Initializes a new instance of the ConferenceService class.    
	 &amp;#39;&amp;#39;&amp;#39; &amp;lt;/summary&amp;gt;    
	 &amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;repo&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;    
	 Public Sub New(ByVal repo As IRepository)        
		_repo = repo    
	 End Sub    
	 
	 Public Function GetUpcomingConferences(ByVal DisplayDate As DateTime) As IList(Of ConferenceEntity)        
		 Dim bucket As New RelationPredicateBucket(ConferenceFields.IsActive = True)        
		 im startfilter As New PredicateExpression(ConferenceFields.StartDisplayDate = System.DBNull.Value)        
		 startfilter.AddWithOr(ConferenceFields.StartDisplayDate &amp;lt;= DisplayDate)        
		 bucket.PredicateExpression.AddWithAnd(startfilter)        
		 Dim endfilter As New PredicateExpression(ConferenceFields.EndDisplayDate = System.DBNull.Value)        
		 endfilter.AddWithOr(ConferenceFields.EndDisplayDate &amp;gt;= DisplayDate)        
		 bucket.PredicateExpression.AddWithAnd(endfilter)        
		 Dim sorter As New SortExpression(ConferenceFields.StartDateTimeUtc Or SortOperator.Ascending)        
		 Return _repo.GetCollection(Of ConferenceEntity)(bucket, sorter).ToList()            
	End Function   
	
 End Class&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The next piece of code is back in our Bootstrapper that we have to uncomment.&amp;#160; &lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:4dacc245-a5fb-4b5d-8a33-0b609a3d5f05" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="vb"&gt;&amp;#39;ForRequestedType(Of IRepository)().TheDefaultIsConcreteType(Of Repository)().CacheBy(Attributes.InstanceScope.Hybrid) 
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, instead of calling the static method as such:&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:d4be5757-b5d9-4433-ae7e-fae58e8a1e02" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="vb"&gt;Dim upcomingConf as IList(Of ConferenceEntity) = ConferenceService.GetUpcomingConferences(Date.Now())&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We can call it as such:&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:0a87f121-4797-4ecb-9569-309eafd5e8b5" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="vb"&gt;Dim upcomingConf as IList(Of ConferenceEntity) = new ConferenceService(ObjectFactory.GetInstance(Of IRepository)()).GetUpcomingConferences(Date.Now())&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This allows us to decouple the concrete Repository object and allows for testing out our method. We’ll be able to write tests now to cover our legacy code, and allow for more flexible code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54138" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/steve_wright/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Creating a Yellow Fade with ASP.NET AJAX Toolkit</title><link>http://devlicio.us/blogs/steve_wright/archive/2008/01/20/creating-a-yellow-fade-with-asp-net-ajax-toolkit.aspx</link><pubDate>Sun, 20 Jan 2008 17:28:37 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:39276</guid><dc:creator>Stephen Wright</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/steve_wright/rsscomments.aspx?PostID=39276</wfw:commentRss><comments>http://devlicio.us/blogs/steve_wright/archive/2008/01/20/creating-a-yellow-fade-with-asp-net-ajax-toolkit.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve always thought that the &lt;a href="http://www.37signals.com/svn/archives/000558.php" target="_blank"&gt;Yellow Fade Technique&lt;/a&gt; has been a great way to present changes to a web page.&amp;nbsp; It&amp;#39;s used in all of 37Signal&amp;#39;s applications such as BaseCamp and CampFire.&amp;nbsp; It highlights the changes in a page using a yellow background, then fades out to the normal background.&amp;nbsp; This gives a visual cue to the user that something has changed on the page.&amp;nbsp; You can also use it to get the user&amp;#39;s attention (which is what I use it for).&lt;/p&gt; &lt;p&gt;I searched to find the JavaScript to use in my own application and couldn&amp;#39;t find anything that was easily integrated into the &amp;quot;controls&amp;quot; structure of ASP.NET.&amp;nbsp; Anything that I was going to use would need to hack into the body tag and the header tag to place functions initializing it.&amp;nbsp; Here&amp;#39;s a quick way to accomplish this using ASP.NET Ajax and the Control Toolkit.&lt;/p&gt; &lt;p&gt;This example assumes that you have .NET 3.5 and the AJAX Control Toolkit installed.&amp;nbsp; If you don&amp;#39;t have it, you can download the the .NET 3.5 Framework and the Control Toolkit from the official website: &lt;a title="http://asp.net/ajax/ajaxcontroltoolkit/" href="http://asp.net/ajax/"&gt;http://asp.net/ajax/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;For this example, I am using the AnimationExtender.&amp;nbsp; Here&amp;#39;s the .aspx: &lt;/p&gt; &lt;div style="border-right:#cccccc 1px dashed;padding-right:4px;border-top:#cccccc 1px dashed;padding-left:4px;background:#eeeeee;padding-bottom:4px;overflow:auto;border-left:#cccccc 1px dashed;width:525px;padding-top:4px;border-bottom:#cccccc 1px dashed;height:200px;"&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:tahoma;"&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ajaxToolkit:AnimationExtender&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;AnimationExtender1&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;server&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;TargetControlID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;divResponse&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Enabled&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;divResponse&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;server&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;style&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;width: 500px; padding: 10px;&amp;nbsp;&amp;nbsp;&amp;nbsp; margin-bottom: 10px;&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;visible&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;false&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;strong&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;asp:Literal&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;litResponseText&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Server&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;strong&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;Display Name: &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;asp:Textbox&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;txtDisplay&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;server&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;asp:LinkButton&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;btnSubmit&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;server&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Update&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The div named &amp;quot;divResponse&amp;quot; is the container for our response on postback.&amp;nbsp; We can now add the code to handle adding the Animation properties to the AnimationExtender:&lt;br /&gt;&lt;/p&gt;
&lt;div style="border-right:#cccccc 1px dashed;padding-right:4px;border-top:#cccccc 1px dashed;padding-left:4px;background:#eeeeee;padding-bottom:4px;overflow:auto;border-left:#cccccc 1px dashed;width:525px;padding-top:4px;border-bottom:#cccccc 1px dashed;height:200px;"&gt;
&lt;div style="font-size:10pt;background:white;color:black;font-family:tahoma;"&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;Protected&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; btnUpdate_Click(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Object&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:blue;"&gt;As&lt;/span&gt; EventArgs) &lt;span style="color:blue;"&gt;Handles&lt;/span&gt; btnUpdate.Click&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; divResponse.Visible = &lt;span style="color:blue;"&gt;True&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;If&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;.IsNullOrEmpty(txtDisplayName.Text) &lt;span style="color:blue;"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; litResponseText.Text = &lt;span style="color:#a31515;"&gt;&amp;quot;Please enter a Display Name&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnimationExtender1.Animations = &lt;span style="color:#a31515;"&gt;&amp;quot;&amp;lt;OnLoad&amp;gt;&amp;lt;Sequence&amp;gt;&amp;lt;Parallel Duration=&amp;quot;&amp;quot;5&amp;quot;&amp;quot;&amp;gt;&amp;lt;Color Duration=&amp;quot;&amp;quot;5&amp;quot;&amp;quot; StartValue=&amp;quot;&amp;quot;#FF4500&amp;quot;&amp;quot; EndValue=&amp;quot;&amp;quot;#FFFFFF&amp;quot;&amp;quot; Property=&amp;quot;&amp;quot;style&amp;quot;&amp;quot; PropertyKey=&amp;quot;&amp;quot;backgroundColor&amp;quot;&amp;quot; /&amp;gt;&amp;lt;Color Duration=&amp;quot;&amp;quot;4&amp;quot;&amp;quot; StartValue=&amp;quot;&amp;quot;#000000&amp;quot;&amp;quot; EndValue=&amp;quot;&amp;quot;#FF0000&amp;quot;&amp;quot; Property=&amp;quot;&amp;quot;style&amp;quot;&amp;quot; PropertyKey=&amp;quot;&amp;quot;color&amp;quot;&amp;quot; /&amp;gt;&amp;lt;/Parallel&amp;gt;&amp;lt;/Sequence&amp;gt;&amp;lt;/OnLoad&amp;gt;&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;Else&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;&amp;#39;Save your Display Name property&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; litResponseText.Text = &lt;span style="color:#a31515;"&gt;&amp;quot;Updated Successfully&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnimationExtender1.Animations = &lt;span style="color:#a31515;"&gt;&amp;quot;&amp;lt;OnLoad&amp;gt;&amp;lt;Sequence&amp;gt;&amp;lt;Parallel Duration=&amp;quot;&amp;quot;5&amp;quot;&amp;quot;&amp;gt;&amp;lt;Color Duration=&amp;quot;&amp;quot;5&amp;quot;&amp;quot; StartValue=&amp;quot;&amp;quot;#FFD700&amp;quot;&amp;quot; EndValue=&amp;quot;&amp;quot;#FFFFFF&amp;quot;&amp;quot; Property=&amp;quot;&amp;quot;style&amp;quot;&amp;quot; PropertyKey=&amp;quot;&amp;quot;backgroundColor&amp;quot;&amp;quot; /&amp;gt;&amp;lt;Color Duration=&amp;quot;&amp;quot;4&amp;quot;&amp;quot; StartValue=&amp;quot;&amp;quot;#000000&amp;quot;&amp;quot; EndValue=&amp;quot;&amp;quot;#008000&amp;quot;&amp;quot; Property=&amp;quot;&amp;quot;style&amp;quot;&amp;quot; PropertyKey=&amp;quot;&amp;quot;color&amp;quot;&amp;quot; /&amp;gt;&amp;lt;/Parallel&amp;gt;&amp;lt;/Sequence&amp;gt;&amp;lt;/OnLoad&amp;gt;&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;The first thing we want to do is to make the divResponse visible.&amp;nbsp; We then can start our processing.&amp;nbsp; We want to add properties to the AnimationExtender based on if the properties were set properly.&amp;nbsp; If it failed, we add the error text to the litResponseText Literal, then add Animation Property Tag, which would look like this in the end:&lt;/p&gt;
&lt;div style="border-right:#cccccc 1px dashed;padding-right:4px;border-top:#cccccc 1px dashed;padding-left:4px;background:#eeeeee;padding-bottom:4px;overflow:auto;border-left:#cccccc 1px dashed;width:525px;padding-top:4px;border-bottom:#cccccc 1px dashed;height:200px;"&gt;
&lt;div style="font-size:10pt;background:white;color:black;font-family:tahoma;"&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ajaxToolkit:AnimationExtender&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;AnimationExtender1&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;server&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;TargetControlID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;divResponse&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Enabled&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Animations&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;OnLoad&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Sequence&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Parallel&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Duration&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;5&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Color&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Duration&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;5&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;StartValue&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;#FF4500&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;EndValue&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;#FFFFFF&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Property&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;style&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;PropertyKey&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;backgroundColor=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Color&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Duration&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;4&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;StartValue&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;#000000&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;EndValue&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;#FF0000&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Property&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;style&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;PropertyKey&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;color&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Parallel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Sequence&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;OnLoad&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Animations&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ajaxToolkit:AnimationExtender&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The Parallel tag will execute both of the properties at the same time.&amp;nbsp; What we&amp;#39;re doing is starting the div with a background of Red/Orange and fading this color to white, while the text color is fading from Black to Red.&lt;/p&gt;
&lt;p&gt;If the Display Name was valid, we want to note a successful call.&amp;nbsp; This will fade the background from yellow to white and the forecolor from black to green.&lt;/p&gt;
&lt;p&gt;HTH&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=39276" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/steve_wright/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Time Zone Issues</title><link>http://devlicio.us/blogs/steve_wright/archive/2007/11/15/time-zone-issues.aspx</link><pubDate>Thu, 15 Nov 2007 08:37:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38852</guid><dc:creator>Stephen Wright</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/steve_wright/rsscomments.aspx?PostID=38852</wfw:commentRss><comments>http://devlicio.us/blogs/steve_wright/archive/2007/11/15/time-zone-issues.aspx#comments</comments><description>&lt;p&gt;Sounds like a book title, doesn&amp;#39;t it?&amp;nbsp; It&amp;#39;s a horror story.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Currently, I&amp;#39;m using a class library that uses the Windows Registry to return information about a specific date.&amp;nbsp; I found it on Code Project and it REQUIRED a full trust environment. Luckily, I didn&amp;#39;t need to run in a shared hosting environment and I didn&amp;#39;t want to build my own DST provider for every time zone.&amp;nbsp; I&amp;#39;ve been using it for about 2 years now and I think it&amp;#39;s time to move over to the new TimeZone2 functionality that will be included in the .NET Framework 3.5 release.&lt;/p&gt; &lt;p&gt;Kathy Kam, member of the BCL Team, says from a &lt;a href="http://blogs.msdn.com/bclteam/archive/2006/10/03/System.TimeZone2-Starter-Guide-_5B00_Kathy-Kam_5D00_.aspx" target="_blank"&gt;post&lt;/a&gt; a while ago:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;In the “Orcas” September CTP, you’ll see that the BCL team has added a new class named “System.TimeZone2” that will allow you to:  &lt;ul&gt; &lt;li&gt;Convert a DateTime from one time zone (not necessarily your machine’s time zone) to another  &lt;li&gt;Get an object that describes your local time zone  &lt;li&gt;Get an array of objects that describes all the available time zones on your machine  &lt;li&gt;Serialize a time zone into a string  &lt;li&gt;Create your own time zone object to represent any custom time zones&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The best part about this is that… if you are on an Vista machine… all of those functionality will have &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/dynamic_time_zone_information.asp" target="_blank"&gt;Vista’s Dynamic Time Zone&lt;/a&gt; support, because our calculations are done with the time zone data available on your OS.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This is wonderful news for me.&amp;nbsp; I no longer have to depend on the old class library to store my time zone information.&lt;/p&gt; &lt;p&gt;For more information on the TimeZoneInfo Class, you can read about it on the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.timezoneinfo(VS.90).aspx" target="_blank"&gt;MSDN site&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38852" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/steve_wright/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>IE6 VPC Image - Part Deux</title><link>http://devlicio.us/blogs/steve_wright/archive/2007/03/20/ie6-vpc-image-part-deux.aspx</link><pubDate>Tue, 20 Mar 2007 20:46:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:17764</guid><dc:creator>Stephen Wright</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/steve_wright/rsscomments.aspx?PostID=17764</wfw:commentRss><comments>http://devlicio.us/blogs/steve_wright/archive/2007/03/20/ie6-vpc-image-part-deux.aspx#comments</comments><description>&lt;p&gt;Because the license to use the original IE6 VirtualPC image was good until April 1, 2007, Microsoft has released another version.&amp;nbsp; You can download it directly from Microsoft &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&amp;amp;displaylang=en" target="_blank"&gt;here&lt;/a&gt;. &lt;br&gt;&lt;/p&gt;&lt;p&gt;REF: &lt;a href="http://blogs.msdn.com/ie/archive/2007/03/20/ie6-vpc-refresh-now-available.aspx" target="_blank"&gt;IE Team Blog&amp;nbsp;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=17764" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/steve_wright/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>My Favorite Little Function - FixUrl</title><link>http://devlicio.us/blogs/steve_wright/archive/2006/10/07/My-favorite-little-function.aspx</link><pubDate>Sat, 07 Oct 2006 05:45:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:260</guid><dc:creator>Stephen Wright</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/steve_wright/rsscomments.aspx?PostID=260</wfw:commentRss><comments>http://devlicio.us/blogs/steve_wright/archive/2006/10/07/My-favorite-little-function.aspx#comments</comments><description>One problem that I frequently run into is trying to get my javascript URLs to point to the correct directory by using the &amp;quot;~&amp;quot; root for an ASP.NET application.  Here&amp;#39;s a handy function that helps with trying to get to the root of a webapp:
&lt;br /&gt;&lt;br /&gt;
&lt;div style="overflow:auto;"&gt;

&lt;div style="background:white none repeat scroll 0% 50%;font-size:9pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;/span&gt; FixUrl(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; Url &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;) &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;Dim&lt;/span&gt; strReturn &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;If&lt;/span&gt; Url.StartsWith(&lt;span style="color:#a31515;"&gt;&amp;quot;~&amp;quot;&lt;/span&gt;) &lt;span style="color:blue;"&gt;And&lt;/span&gt; HttpContext.Current.Request.ApplicationPath &amp;lt;&amp;gt; &lt;span style="color:#a31515;"&gt;&amp;quot;/&amp;quot;&lt;/span&gt; &lt;span style="color:blue;"&gt;Then&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; strReturn = HttpContext.Current.Request.ApplicationPath &amp;amp; Url.Substring(1).Replace(&lt;span style="color:#a31515;"&gt;&amp;quot;//&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;ElseIf&lt;/span&gt; Url.StartsWith(&lt;span style="color:#a31515;"&gt;&amp;quot;~&amp;quot;&lt;/span&gt;) &lt;span style="color:blue;"&gt;Then&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; strReturn = Right(Url, Len(Url) - 1)&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;Else&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; strReturn = Url&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;If&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;Return&lt;/span&gt; strReturn&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;&lt;p&gt;
So what this function will do is take any URL that is passed (such as &amp;quot;~/admin/user.aspx&amp;quot;) will return the proper directory.

&lt;/p&gt;&lt;p&gt;If you are running your application at this URL: http://mytestapp.domain.com/, it will return &amp;quot;/admin/user.aspx&amp;quot;.  If you are running it locally for testing, such as http://localhost/mytestapp/, it will return &amp;quot;/mytestapp/admin/user.aspx&amp;quot;.

&lt;/p&gt;&lt;p&gt;This helps out when you are adding URLs to javascript calls through code (such as window.open(&amp;#39;/admin/user.aspx&amp;#39;, null, &amp;#39;etc...) and need to have a generic way to find the root of your application because the tilde will not work in this context.

&lt;/p&gt;&lt;p&gt;Enjoy! &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=260" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/steve_wright/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>