Tuesday, September 20, 2011

Url address without query string in .NET

I was going through a System.Uri class and found the following handy method:
public string GetLeftPart(UriPartial part)
This allows to get certain combined parts of the URL.
For instance if you have address "http://myhost.com/local/path/Page.aspx?field1=Name&value1=abcdef" and you need to cut it to "http://myhost.com/local/path/Page.aspx" part, you could do the following:
Uri uri = new Uri("http://myhost.com/local/path/Page.aspx?field1=Name&value1=abcdef");
string addressPart = uri.GetLeftPart(UriPartial.Path);

Wednesday, September 7, 2011

Replacing TFS service account

Today I had an issue with TFS. To describe the problem shortly: I needed to replace old TFS service account with the new one. 
The following magic command did the trick :

tfsadminutil changeaccount domain\tfs_svc domain\tfs_svc_new password_for_tfs_svc_new

Command's description can be found here: http://msdn.microsoft.com/en-us/library/ms253107(v=VS.90).aspx