本文整理汇总了C#中Storage.GetFileInfoBegin方法的典型用法代码示例。如果您正苦于以下问题:C# Storage.GetFileInfoBegin方法的具体用法?C# Storage.GetFileInfoBegin怎么用?C# Storage.GetFileInfoBegin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage.GetFileInfoBegin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginProcessRequest
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
{
bool bStartAsync = false;
try
{
_log.Info("Starting process request...");
_log.Info(context.Request.QueryString.ToString());
Storage oStorage = new Storage();
ITaskResultInterface oTaskResult = TaskResult.NewTaskResult();
string sPathOriginal = context.Request.QueryString["path"];
string sPath = null;
if (null != sPathOriginal)
{
sPath = sPathOriginal.Replace("../", "").Replace("..\\", "");
if (sPathOriginal != sPath)
{
_log.Error("Possible XSS attack:" + sPathOriginal);
}
}
string sOutputFilename = context.Request.QueryString["filename"];
string sDeletePathOriginal = context.Request.QueryString["deletepath"];
string sDeletePath = null;
if (null != sDeletePathOriginal)
{
sDeletePath = sDeletePathOriginal.Replace("../", "").Replace("..\\", "");
if (sDeletePathOriginal != sDeletePath)
{
_log.Error("Possible XSS attack:" + sDeletePathOriginal);
}
}
string sNoCache = context.Request.QueryString["nocache"];
if (string.IsNullOrEmpty(sOutputFilename))
{
if (null != sPath)
{
int nIndex1 = sPath.LastIndexOf('/');
int nIndex2 = sPath.LastIndexOf('\\');
if (-1 != nIndex1 || -1 != nIndex2)
{
int nIndex = Math.Max(nIndex1, nIndex2);
sOutputFilename = sPath.Substring(nIndex + 1);
}
else
sOutputFilename = "resource";
}
}
context.Response.Clear();
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.ContentType = Utils.GetMimeType(sOutputFilename);
string contentDisposition = Utils.GetContentDisposition(context.Request.UserAgent, context.Request.Browser.Browser, context.Request.Browser.Version, sOutputFilename);
context.Response.AppendHeader("Content-Disposition", contentDisposition);
if (null != sPath)
{
TransportClass oTransportClass = new TransportClass(context, cb, oStorage, oTaskResult, sPath, sDeletePath);
oStorage.GetFileInfoBegin(sPath, GetFileInfoCallback, oTransportClass);
bStartAsync = true;
}
else
context.Response.StatusCode = (int)HttpStatusCode.NotFound;
}
catch(Exception e)
{
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
_log.Error(context.Request.QueryString.ToString());
_log.Error("Exeption catched in BeginProcessRequest:", e);
}
TransportClass oTempTransportClass = new TransportClass(context, cb, null, null, null, null);
if (false == bStartAsync)
cb(new AsyncOperationData(oTempTransportClass));
return new AsyncOperationData(oTempTransportClass);
}