London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Change virtual path for VPP

Vote:
 

EPiServer CMS 6, version 6.0.530.0

I have migrated an EPiServer 4 site to EPiServer CMS 5, then upgraded to CMS 6. After the migration the upload directory is declared something like this in web.config:
<add showInFileManager="true" virtualName="Upload" virtualPath="~/Upload/" bypassAccessCheck="false" indexingServiceCatalog="Web" name="Upload" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" physicalPath="[PATH]\VPP\Upload" />

Renaming the physical directory to "Files_sv" and changing the line in web.config to this works ok:
<add showInFileManager="true" virtualName="svenska" virtualPath="~/Upload/" bypassAccessCheck="false" indexingServiceCatalog="Web" name="Files_sv" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" physicalPath="[PATH]\VPP\Files_sv" />

But I also would like to change the virtual path to this "~/Files-sv/".

How can I change the virtual path for a virtual path provider the best way? SQL script or through the API?

/Hans

#42277
Aug 17, 2010 15:28
Vote:
 

I managed to do it with SQL script

DECLARE @OldPath NVARCHAR(20) = '/upload/'
DECLARE @NewPath NVARCHAR(20) = '/Files-sv/'

UPDATE
           tblUnifiedPath
SET
           [Path] = @NewPath + SUBSTRING([Path], LEN(@OldPath) + 1, LEN([Path]) - LEN(@NewPath))
WHERE
           [Path] LIKE (@OldPath + '%')

DECLARE @OldName NVARCHAR(20) = 'upload'
DECLARE @NewName NVARCHAR(20) = 'Files-sv'

UPDATE
           tblItem
SET
           [Name] = @NewName
WHERE
           [Name] = @OldName

UPDATE
           tblRelation
SET
           [ToName] = @NewName
WHERE
           [ToName] = @OldName

I have just tested it quickly, so you better test it if you try it.

/Hans

#42314
Aug 18, 2010 15:45
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.