示例#1
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"/> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests. </param>
        public void ProcessRequest(HttpContext context)
        {
            RoleType? roleType = context.User.Identity.IsAuthenticated ? UserProfile.GetRoleForUser(context.User.Identity.Name) : new RoleType?();
            bool isAdmin = roleType.HasValue && (roleType.Value == RoleType.Admin || roleType.Value == RoleType.AdminLeader);

            string idRequest = context.Request.QueryString["id"];
            int id;
            Int32.TryParse(idRequest ?? String.Empty, out id);

            string token = context.Request.QueryString["token"];

            var server = new HttpServerUtilityWrapper(context.Server);
            var streamVideoStream = new StreamVideoStream(isAdmin, id, token, server);
            if (!streamVideoStream.IsValid)
                throw new Exception("Cannot process video stream.");

            context.Response.Clear();
            context.Response.ContentType = HttpResponseBaseService.GetContentType(streamVideoStream.VideoRelativeFilePath);
            context.Response.TransmitFile(streamVideoStream.VideoRelativeFilePath);
        }
示例#2
0
 public static bool LogException(this HttpServerUtility server, Exception exception)
 {
     var serverBase = new HttpServerUtilityWrapper(server) as HttpServerUtilityBase;
     return serverBase.LogException(exception);
 }
示例#3
0
 public static XDocument GetLogXml(this HttpServerUtility server)
 {
     var serverBase = new HttpServerUtilityWrapper(server) as HttpServerUtilityBase;
     return serverBase.GetLogXml();
 }
示例#4
0
 public static string GetLogPath(this HttpServerUtility server)
 {
     var serverBase = new HttpServerUtilityWrapper(server) as HttpServerUtilityBase;
     return serverBase.GetLogPath();
 }