November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Are you using a custom VPP or one of the built in ones from EPiServer?
Frederik
Custom VPP. and i registered it in episerver.config
<add showInFileManager="true" virtualName="Upload" virtualPath="~/Upload/" bypassAccessCheck="false" name="Upload" type="CMS.Modules.VirtualPathProvider.VirtualPathDatabaseProvider,CMS.Modules.VirtualPathProvider" connectionStringName="CMS.Data.Properties.Settings.Upload_ConnectionString" physicalPath="" />
#region Fields
private string connectionString;
private DbDirectory mRoot;
#endregion
#region Constructors
public VirtualPathDatabaseProvider(string name, NameValueCollection configParameters)
: base(name, configParameters)
{
base.ValidateAndSetupConfigParams();
this.connectionString = VirtualPathProviderConnectionString.GetConnectionStringByName(configParameters["connectionStringName"]);
VirtualPathProviderConnectionString.CreateInstance(name, this.connectionString);
this.mRoot = this.GetRootDirectory();
if (this.mRoot != null)
{
string root = this.mRoot.Name;
if (!String.IsNullOrEmpty(root))
{
base.VirtualPathRoot = root;
}
}
}
#endregion
#region Methods
private DbDirectory GetRootDirectory()
{
DbDirectory result = null;
try
{
SqlConnection conn = new SqlConnection(this.connectionString);
try
{
DirectoriesTableAdapter ta = new DirectoriesTableAdapter();
if (this.connectionString != null)
{
ta.Connection = conn;
}
DbDirectoryDS ds = new DbDirectoryDS();
ta.FillRootDirectory(ds.Directories);
if (ds.Directories.Rows.Count > 0)
{
DbDirectoryDS.DirectoriesRow row =
(DbDirectoryDS.DirectoriesRow)ds.Directories.Rows[0];
result =
new DbDirectory(row.ID,
row.ParentID,
row.Name,
row.ACL,
this,
VirtualPathUtility.AppendTrailingSlash(
VirtualPathUtility.ToAbsolute(ConfigurationParameters["virtualPath"]))
);
}
}
catch (SqlException ex)
{
Modules.ErrorTracing.ErrorManager.TraceException(ex);
}
catch (Exception ex)
{
Modules.ErrorTracing.ErrorManager.TraceException(ex);
}
finally
{
conn.Close();
}
}
catch (ArgumentException ex)
{
Modules.ErrorTracing.ErrorManager.TraceException(ex);
}
catch (Exception ex)
{
Modules.ErrorTracing.ErrorManager.TraceException(ex);
}
return result;
}
public override bool FileExists(string virtualPath)
{
if (this.mRoot == null)
this.mRoot = this.GetRootDirectory();
if (virtualPath.StartsWith(this.mRoot.VirtualPath, StringComparison.InvariantCultureIgnoreCase))
{
return (this.FindFile(virtualPath) != null);
}
return Previous.FileExists(virtualPath);
}
public override bool DirectoryExists(string virtualDir)
{
if (this.mRoot == null)
this.mRoot = this.GetRootDirectory();
if (virtualDir.StartsWith(this.mRoot.VirtualPath, StringComparison.InvariantCultureIgnoreCase))
{
return (this.FindDirectory(virtualDir) != null);
}
return Previous.DirectoryExists(virtualDir);
}
public override System.Web.Hosting.VirtualFile GetFile(string virtualPath)
{
if (virtualPath.StartsWith(this.mRoot.VirtualPath, StringComparison.InvariantCultureIgnoreCase))
{
return this.FindFile(virtualPath);
}
return Previous.GetFile(virtualPath);
}
public override System.Web.Hosting.VirtualDirectory GetDirectory(string virtualDir)
{
if (virtualDir.StartsWith(this.mRoot.VirtualPath, StringComparison.InvariantCultureIgnoreCase))
{
return this.FindDirectory(virtualDir);
}
return Previous.GetDirectory(virtualDir);
}
public DbFile FindFile(string virtualPath)
{
string fileName = VirtualPathUtility.GetFileName(virtualPath);
DbDirectory fileParentDirectory = this.FindDirectory(VirtualPathUtility.GetDirectory(virtualPath));
if (fileParentDirectory == null)
{
return null;
}
DbFile result = fileParentDirectory.GetFile(fileName);
return result;
}
public DbDirectory FindDirectory(string virtualPath)
{
DbDirectory currentDirectory = this.mRoot;
if (virtualPath.StartsWith(currentDirectory.VirtualPath, StringComparison.InvariantCultureIgnoreCase))
{
virtualPath = virtualPath.Remove(0, currentDirectory.VirtualPath.Length);
}
string[] dirPath =
virtualPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string subDir in dirPath)
{
if ((currentDirectory = currentDirectory.GetDirectory(subDir)) == null)
{
return null;
}
}
return currentDirectory;
}
#endregion
Hi,
first, as this is a custom VPP, I do not see why you need to register it like in the Sunali link above. A simple VPP registration in episerver.config should be enough.
Also, this looks like an early version of the Database VPP available on EPiCode (http://www.epicode.no). The version on EPiCode has gone through a major upgrade, but still have almost the same database structure. If possible, you should look into getting the EPiCode version going (most work will be comparing database structures and sp's).
For the problem you describe, it sounds strange that it works locally, but not on the server. You need to look into what differences you have between the two environments.
/Steve
Hi Steve,
Thanks for your replay.
I will check the new upgrades in the EPiCode.
I was using Sunali approach because i publish a precompiled website (Thats why it is working local..soryy i had to mention that early).
Thanks Steve.
It is working now after getting the EPiCode version and updating the virtual path provider.
I was using a virtual path provider in my CMS5 website to store my files in a SQL database
and i was registering it in the hosting environment using Sunali workaround HERE and it was working fine both local and on the server.
But after upgrade the virtual path provider was crashing .. i removed the registeration and it worked fine local but when deploying to the server the site is working but it can't see any of my database files and retrieves nothing.
Can please advice where may be the problem?