本文整理汇总了C#中System.Net.Http.HttpResponseMessage.GetDirectUriRequest方法的典型用法代码示例。如果您正苦于以下问题:C# HttpResponseMessage.GetDirectUriRequest方法的具体用法?C# HttpResponseMessage.GetDirectUriRequest怎么用?C# HttpResponseMessage.GetDirectUriRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.HttpResponseMessage
的用法示例。
在下文中一共展示了HttpResponseMessage.GetDirectUriRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderOpenIdMessageTransmissionAsAnchorAttributes
/// <summary>
/// Adds attributes to an HTML <A> tag that will be written by the caller using
/// <see cref="HtmlTextWriter.RenderBeginTag(HtmlTextWriterTag)" /> after this method.
/// </summary>
/// <param name="writer">The HTML writer.</param>
/// <param name="response">The response.</param>
/// <param name="windowStatus">The text to try to display in the status bar on mouse hover.</param>
protected void RenderOpenIdMessageTransmissionAsAnchorAttributes(HtmlTextWriter writer, HttpResponseMessage response, string windowStatus) {
Requires.NotNull(writer, "writer");
Requires.NotNull(response, "response");
// We render a standard HREF attribute for non-javascript browsers.
writer.AddAttribute(HtmlTextWriterAttribute.Href, response.GetDirectUriRequest().AbsoluteUri);
// And for the Javascript ones we do the extra work to use form POST where necessary.
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, this.CreateGetOrPostAHrefValue(response) + " return false;");
writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "pointer");
if (!string.IsNullOrEmpty(windowStatus)) {
writer.AddAttribute("onMouseOver", "window.status = " + MessagingUtilities.GetSafeJavascriptValue(windowStatus));
writer.AddAttribute("onMouseOut", "window.status = null");
}
}
示例2: CreateGetOrPostAHrefValue
/// <summary>
/// Gets the javascript to executee to redirect or POST an OpenID message to a remote party.
/// </summary>
/// <param name="requestRedirectingResponse">The request redirecting response.</param>
/// <returns>
/// The javascript that should execute.
/// </returns>
private string CreateGetOrPostAHrefValue(HttpResponseMessage requestRedirectingResponse) {
Requires.NotNull(requestRedirectingResponse, "requestRedirectingResponse");
Uri directUri = requestRedirectingResponse.GetDirectUriRequest();
return "window.dnoa_internal.GetOrPost(" + MessagingUtilities.GetSafeJavascriptValue(directUri.AbsoluteUri) + ");";
}