Using CKFinder on multiple pages with different configuration in ASP.Net

521 Views Asked by At

I am using CKFinder latest version on my ASP.Net website and it is working ok. Now, I want to use the same CKFinder on multiple pages with different BaseUrls. Currently the BaseUrl is set in config.ascx file of ckfinder and I want to change this based on the page I am or the role I am logged in as.

I followed this and this questions on SO to try and implement something similar, but it does not work. I have tried setting the BaseUrl in config.ascx file as below -

    if (Request.Url.AbsolutePath.Equals("Lifestyle.aspx"))
        BaseUrl = "/images/Lifestyle";
    else
        BaseUrl = "/images/";

However, everytime the .ascx file loads, the Request.Url.AbsilutePath contains the value as "/core/connector/aspx/connector.aspx" and not the original file it is present.

Any ideas in progressing would greatly help me.

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

I have resolved this by setting a Session value in my main page and using the Session variable in config.ascx file. Something like below -

if (Session["PageName"] =="Lifestyle.aspx")
    BaseUrl = "/images/Lifestyle";
else
    BaseUrl = "/images/";

On the page where I am using the CKFinder control, I am setting Session["PageName"] to the desired page name.