c# - Changing the scheme of System.Uri -


i'm looking canonical way of changing scheme of given system.uri instance system.uribuilder without crappy string manipulations , magic constants. have

var uri = new uri("http://localhost/hello") 

and need change 'https'. issue in limited uribuilder ctors , uri.port defaulting 80 (should change 443? hardcoding?). code must respect uri properties such possible basic auth credentials, query string, etc.

ended one:

var uribuilder = new uribuilder(requesturl) {     scheme = uri.urischemehttps,     port = -1 // default port scheme }; 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -