/// <summary> /// Gets the length of the URL that would be used for a simple redirect to carry /// this indirect message to its recipient. /// </summary> /// <param name="message">The message.</param> /// <returns>The number of characters in the redirect URL.</returns> static int getSizeOfPayload(IEncodable message) { Debug.Assert(message != null); UriBuilder redirect = new UriBuilder(message.RedirectUrl); UriUtil.AppendQueryArgs(redirect, message.EncodedFields); return(redirect.Uri.AbsoluteUri.Length); }
protected virtual Response Create301RedirectResponse(IEncodable message) { WebHeaderCollection headers = new WebHeaderCollection(); UriBuilder builder = new UriBuilder(message.RedirectUrl); UriUtil.AppendQueryArgs(builder, message.EncodedFields); headers.Add(HttpResponseHeader.Location, builder.Uri.AbsoluteUri); //Logger.DebugFormat("Redirecting to {0}", builder.Uri.AbsoluteUri); return(new Response(HttpStatusCode.Redirect, headers, new byte[0], message)); }
/// <summary> /// Returns the string form of this <see cref="Realm"/>. /// </summary> public override string ToString() { if (DomainWildcard) { UriBuilder builder = new UriBuilder(uri); builder.Host = "*." + builder.Host; return(UriUtil.UriBuilderToStringWithImpliedPorts(builder)); } else { return(uri.AbsoluteUri); } }
public byte[] GetBytes(IDictionary <string, string> dictionary) { return(Encoding.ASCII.GetBytes(UriUtil.CreateQueryString(dictionary))); }