Beispiel #1
0
 /// <summary>
 /// Check if access to path should be granted.
 /// </summary>
 /// <param name="strFullName"></param>
 /// <returns>True if access is granted, false if not</returns>
 private bool GrantPathAccess(string strFullName)
 {
     if (this.GrantedPaths() != null && this.GrantedPaths().Length > 0)
     {
         string strFilePath = Path.GetDirectoryName(Path.GetFullPath(strFullName)) + '\\';
         foreach (string strPath in this.GrantedPaths())
         {
             string mstrPathToCompare = (StaticFileResourceHandle.removeBackslash(strPath) + '\\');
             if (mstrPathToCompare.Length > strFilePath.Length)
             {
                 return(false);
             }
             else if (!strFilePath.StartsWith(mstrPathToCompare, StringComparison.InvariantCulture))
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(true);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticFileResourceHandle"/> class.
 /// Automatically detects content type based on strFilename's extension
 /// </summary>
 /// <param name="strFileName">The filename to reference</param>
 public StaticFileResourceHandle(string strFileName)
     : this(strFileName, StaticFileResourceHandle.detectContentType(strFileName), typeof(StaticFileResourceHandle).FullName, typeof(StaticFileResourceHandle))
 {
 }
Beispiel #3
0
 /// <summary>
 /// Static constructor to get a full path to the Application folder
 /// Requests arriving as Gateway requests don't have context, so path must be saved as static variable.
 ///
 /// This is a static constructor which means it is invoked once per application, before the first
 /// instance if the class is instanciated.
 /// </summary>
 static StaticFileResourceHandle()
 {
     mstrApplicationPath = StaticFileResourceHandle.removeBackslash(VWGContext.Current.Server.MapPath("~"));
 }