Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class UriExtensions
- {
- public static void GetUsernamePassword(this Uri uri, out string userName, out string password)
- {
- userName = string.Empty;
- password = string.Empty;
- if (uri == null || string.IsNullOrWhiteSpace(uri.UserInfo))
- return;
- var items = uri.UserInfo.Split(new[] { ':' });
- if (items.Length > 0) userName = items[0];
- if (items.Length > 1) password = items[1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement