mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
23 lines
735 B
C#
23 lines
735 B
C#
using System.Web;
|
|
|
|
namespace OnlineEditorsExample
|
|
{
|
|
public static class Utils
|
|
{
|
|
// get the request header or return the default one
|
|
public static string GetOrDefault(this HttpRequest request, string header, string def)
|
|
{
|
|
var value = request[header];
|
|
if (value != null) return value;
|
|
return def;
|
|
}
|
|
|
|
// get a cookie from the cookie collection or return the default one
|
|
public static string GetOrDefault(this HttpCookieCollection cookies, string cookie, string def)
|
|
{
|
|
var cook = cookies[cookie];
|
|
if (cook != null && !string.IsNullOrEmpty(cook.Value)) return cook.Value;
|
|
return def;
|
|
}
|
|
}
|
|
} |