BeginGet() public method

Initiates an asynchronous get of the binary file specified by fileGuid
public BeginGet ( AsyncCallback callback, HttpContext context, System.Guid fileGuid ) : IAsyncResult
callback AsyncCallback The callback.
context System.Web.HttpContext The context.
fileGuid System.Guid The file unique identifier.
return IAsyncResult
Ejemplo n.º 1
0
        /// <summary>
        /// Begins the process binary file request.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="cb">The cb.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">file id key must be a guid or an int</exception>
        private static IAsyncResult BeginProcessBinaryFileRequest( HttpContext context, AsyncCallback cb )
        {
            int fileId = context.Request.QueryString["id"].AsInteger() ?? 0;
            Guid fileGuid = context.Request.QueryString["guid"].AsGuid();

            if ( fileId == 0 && fileGuid.Equals( Guid.Empty ) )
            {
                throw new Exception( "file id key must be a guid or an int" );
            }

            BinaryFileService binaryFileService = new BinaryFileService();
            if ( fileGuid != Guid.Empty )
            {
                return binaryFileService.BeginGet( cb, context, fileGuid );
            }
            else
            {
                return binaryFileService.BeginGet( cb, context, fileId );
            }
        }