Dynamic ImageGalleryPath in VB2005

  •  08-09-2007, 5:12 AM

    Dynamic ImageGalleryPath in VB2005

    I'm using Cuteeditor in a VS2005 Website, often as a replacement template for a text box.
     
    All my users log into the website with a username and password, which means that their profile is known.
     
    I would like to specify upload directories based on the conventional "~/uploads" directory extended with a four character number that is present in my user's profiles.
     
    I was able to do this using a sub as follows :
    1. when the Editor is not in a template :

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Editor1.Setting(
    "security:ImageGalleryPath") = "~/uploads/" & Profile.District
    End Sub
     
    2. when the Editor is in a template :

    Protected Sub Editor1_Init(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim tbxEditor1 As Editor = DetailsView1.FindControl("Editor1")
    tbxEditor1.Setting(
    "security:ImageGalleryPath") = "~/uploads/" & Profile.District
    End Sub


    Then, when I upload an image I can see ~/uploads/9999 for example.

     
    The solution I found works, but I need to type a subroutine for each copy of the editor in any page.
     
    I wonder if someone has found a solution to code such a composed path in a permanent way at the session level or the application level, or even at the page level ?
     
    Thanks in advance.
View Complete Thread