How to set the start location of FolderBrowserDialog in C# and VB.NET

To set the start location of FolderBrowserDialog in C# and VB.NET you can use the following snippet.
To do so, simply set the SelectedPath Value to the path you want.

Sample C#

MyFolderBrowserDialog.SelectedPath = @"C:\Test";

Sample VB.NET

MyFolderBrowserDialog.SelectedPath = "C:\Test"

Please rate this snippet

How to do a HTTP redirect using Javascript or jQuery

To do a HTTP redirect using Javascript or jQuery you can use the window.location.href or the window.location.replace property.

Sample Javascript href

window.location.replace("http://codesnippets.fesslersoft.de");

Sample Javascript replace

window.location.href = "http://codesnippets.fesslersoft.de";

difference of these two

you should use replace if you want to create a http redirect and href if you want to simulate a click.

 

You can also do this in jQuery but i personally prefer the methods shown above because there is no need to use jQuery for a http redirect.

Sample jQuery

var newUrl = "http://codesnippets.fesslersoft.de";    
$(location).attr('href',newUrl);

for more information see W3Schools: Location href Property, Location replace() Method

Please rate this snippet