本文整理汇总了C#中RequestHeader类的典型用法代码示例。如果您正苦于以下问题:C# RequestHeader类的具体用法?C# RequestHeader怎么用?C# RequestHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestHeader类属于命名空间,在下文中一共展示了RequestHeader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
private static string Get(RequestHeader requestHeader)
{
var name = RequestHeaders[requestHeader];
if (HttpContext.Current == null || !HttpContext.Current.Items.Contains(name))
return null;
var value = HttpContext.Current.Items[name];
return value == null ? null : value.ToString();
}
示例2: RequestPackage
public RequestPackage(RequestHeader header, byte[] data)
{
if (header == null) throw new ArgumentNullException("header");
if (data == null) throw new ArgumentNullException("data");
if (data.Length == 0) throw new ArgumentOutOfRangeException("data");
this.Header = header;
this.Data = data;
}
示例3: Read
public RequestBody Read(NetworkStream connection, RequestHeader header)
{
var encoding = Encoding.GetEncoding(header.GetContentEncoding());
var requestReader = new StreamReader(connection, encoding);
var body = new char[header.GetContentLength()];
requestReader.Read(body, 0, header.GetContentLength());
return new RequestBody(body);
}
示例4: Nsi
public Nsi()
{
//fixture.Customizations.Add(new TypeRelay(typeof(XmlNode),typeof(Helper)));
//fixture.Customizations.Add(new TypeRelay(typeof(XmlResolver),typeof(Resolver)));
//fixture.Customize(new AutoConfiguredMoqCustomization());
header = new RequestHeader
{
MessageGUID = Guid.NewGuid().ToString(),
Date = DateTime.Now,
SenderID = "fake service"
};
}
示例5: StitchRequestHeader
private string StitchRequestHeader(HttpRequestMessage request, RequestHeader requestHeader)
{
string value = null;
var name = RequestContext.RequestHeaders[requestHeader];
if (request.Headers.Contains(name))
value = request.Headers.GetValues(name).First();
else if (_generateIfMissing)
value = Guid.NewGuid().ToString();
else
_errors.Add(string.Format("{0} is missing from the request", name));
RequestContext.Set(requestHeader, value);
return value;
}
示例6: Main
static void Main(string[] args)
{
Console.WriteLine("Client starting....");
using (NsiClient client = new NsiClient())
{
var header = new RequestHeader();
var request = new exportNsiListRequest();
var result = client.exportNsiList(ref header, request);
Console.WriteLine("result id is {0}", result.Id);
}
using (RegOrgPortsTypeClient client1 = new RegOrgPortsTypeClient())
{
//will be implemented later
}
Console.WriteLine("Client will be terminated.");
Console.ReadKey();
}
示例7: Main
static void Main(string[] args)
{
Console.ReadLine();
Console.WriteLine(@"Upload video");
using (var client = new TcpClient(@"127.0.0.1", 11111))
{
var handler = new TransferHandler(client.GetStream(), new byte[16 * 1024]);
//var config = new LogConfig(new RequestHeader(ClientPlatform.WinMobile, new Version(0, 0, 0, 0), string.Empty, string.Empty), Category.Logs, @"C:\Temp\");
//new LogsClientHandler(2, handler).ConfigureAsync(config).Wait();
var path = @"C:\Users\bg900343\Desktop\DEV-B318.wmv";
var clientFile = new ClientFile(Path.GetFileName(path), File.ReadAllBytes(path));
var requestHeader = new RequestHeader(ClientPlatform.WinMobile, new Version(0, 0, 0, 0), string.Empty, string.Empty);
new LogsClientHandler(2, handler).UploadFilesAsync(requestHeader, new List<ClientFile> { clientFile }).Wait();
handler.CloseAsync().Wait();
}
Console.WriteLine(@"Done");
Console.ReadLine();
}
示例8: OperationContext
/// <summary>
/// Initializes the context with a session.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="requestType">Type of the request.</param>
public OperationContext(RequestHeader requestHeader, RequestType requestType)
{
if (requestHeader == null) throw new ArgumentNullException("requestHeader");
m_channelContext = SecureChannelContext.Current;
m_session = null;
m_identity = null;
m_preferredLocales = new string[0];
m_diagnosticsMask = (DiagnosticsMasks)requestHeader.ReturnDiagnostics;
m_stringTable = new StringTable();
m_auditLogEntryId = requestHeader.AuditEntryId;
m_requestId = Utils.IncrementIdentifier(ref s_lastRequestId);
m_requestType = requestType;
m_clientHandle = requestHeader.RequestHandle;
m_operationDeadline = DateTime.MaxValue;
if (requestHeader.TimeoutHint > 0)
{
m_operationDeadline = DateTime.UtcNow.AddMilliseconds(requestHeader.TimeoutHint);
}
}
示例9: ConfigureFolderTapped
private async void ConfigureFolderTapped(object sender, TappedRoutedEventArgs e)
{
var btn = (sender as Button);
if (btn != null)
{
var ctx = btn.DataContext as LogCategoryViewModel;
if (ctx != null)
{
btn.IsEnabled = false;
try
{
var path = Path.Combine(new[] { @"C:\Temp\", ctx.Platform.ToString(), ctx.Category.ToString() });
using (var socket = new StreamSocket())
{
await socket.ConnectAsync(new HostName(@"127.0.0.1"), @"11111");
var handler = new WinRtTransferHandler(socket);
var requestHeader = new RequestHeader(ctx.Platform, new Version(0, 0, 0, 0), string.Empty, string.Empty);
var config = new LogConfig(requestHeader, ctx.Category, path);
await new LogsClientHandler(2, handler).ConfigureAsync(config);
await handler.CloseAsync();
}
ctx.Path = path;
}
catch
{
}
finally
{
btn.IsEnabled = true;
}
}
}
}
示例10: HistoryUpdate
/// <summary>
/// Invokes the HistoryUpdate service.
/// </summary>
public virtual ResponseHeader HistoryUpdate(
RequestHeader requestHeader,
ExtensionObjectCollection historyUpdateDetails,
out HistoryUpdateResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例11: HistoryRead
/// <summary>
/// Invokes the HistoryRead service.
/// </summary>
public virtual ResponseHeader HistoryRead(
RequestHeader requestHeader,
ExtensionObject historyReadDetails,
TimestampsToReturn timestampsToReturn,
bool releaseContinuationPoints,
HistoryReadValueIdCollection nodesToRead,
out HistoryReadResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例12: QueryNext
/// <summary>
/// Invokes the QueryNext service.
/// </summary>
public virtual ResponseHeader QueryNext(
RequestHeader requestHeader,
bool releaseContinuationPoint,
byte[] continuationPoint,
out QueryDataSetCollection queryDataSets,
out byte[] revisedContinuationPoint)
{
queryDataSets = null;
revisedContinuationPoint = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例13: UnregisterNodes
/// <summary>
/// Invokes the UnregisterNodes service.
/// </summary>
public virtual ResponseHeader UnregisterNodes(
RequestHeader requestHeader,
NodeIdCollection nodesToUnregister)
{
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例14: BrowseNext
/// <summary>
/// Invokes the BrowseNext service.
/// </summary>
public virtual ResponseHeader BrowseNext(
RequestHeader requestHeader,
bool releaseContinuationPoints,
ByteStringCollection continuationPoints,
out BrowseResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例15: DeleteReferences
/// <summary>
/// Invokes the DeleteReferences service.
/// </summary>
public virtual ResponseHeader DeleteReferences(
RequestHeader requestHeader,
DeleteReferencesItemCollection referencesToDelete,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}