1

I would like to use another protocol than http(s):// in particular i want to build a URL that begins with vrchat:// but for some reason it always kills the second /

        var url = "vrchat://".AppendPathSegment("launch");
        if (!string.IsNullOrWhiteSpace(innerString)) {
            url.SetQueryParam("id", innerString, true);
        }
        //url.SetQueryParam("ref", "vrchat.com");
        Console.WriteLine("Connecting to {0}", url);

Results in

Connecting to vrchat:/launch?id=wrld_b805006c-bec7-4179-958a-5a9351e48d5c

1 Answer 1

1

You're not actually appending a path segment there, you're appending an authority. The main behaviors of AppendPathSegment over plain old string concatenation are encoding and ensuring 1 and only 1 / character between segments, which is most likely causing what you're seeing. You don't want or need those behaviors here, so (assuming authority is variable) just use string concatenation:

var url = "vrchat://" + authority;
// or
var url = $"vrchat://{authority}";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.