I am using the RadEditor in a site Admin tool, whose directory is a nested application within the main site (main site / Admin)... The main site has an Assets directory where images are stored (main site / Assets / Images) and I would like ImagesPaths to read from this location. I have tried:
~/Assets/Images
../Assets/Images
/Assets/Images
./Assets/Images
None of the above work, File Manager opens blank...
Anyone know how to do this?
Thanks!
G!
5 Answers, 1 is accepted
0
ManniAT
Top achievements
Rank 2
answered on 06 May 2009, 02:25 PM
Hi,
I'm not realy clear what you mean with a "nested solution".
Ideas:
http://mysite.com/default.aspx is the "main page" of your application.
If there is a directory http://mysite.com/Assets/Images than your first approach ~/Assets... would work.
If http://mysite.com/MyNestedSol/default.aspx would be the main page you can't reach
http://mysite.com/Assets/Images from there.
The simpliest way to solve your problem is:
a.) create an aspx page with a textbox and a button on it
b.) In the (server) click handler of the box try to translate the text of your textbox with MapPath and ResolveUrl
--check whats comming out via debug - or add an extra control to set the value.
Be sure that you create the page in your "nested solution".
ResolveUrl for an example would translate ~/default.aspx to /default.aspx if your app is "rooted" if not it maybe translated to something like /MyApp/default.aspx.
If you can translate your path finally - you should have the solution for the problem - or in other words the value you have to set in file explorer.
Regards
Manfred
I'm not realy clear what you mean with a "nested solution".
Ideas:
http://mysite.com/default.aspx is the "main page" of your application.
If there is a directory http://mysite.com/Assets/Images than your first approach ~/Assets... would work.
If http://mysite.com/MyNestedSol/default.aspx would be the main page you can't reach
http://mysite.com/Assets/Images from there.
The simpliest way to solve your problem is:
a.) create an aspx page with a textbox and a button on it
b.) In the (server) click handler of the box try to translate the text of your textbox with MapPath and ResolveUrl
--check whats comming out via debug - or add an extra control to set the value.
Be sure that you create the page in your "nested solution".
ResolveUrl for an example would translate ~/default.aspx to /default.aspx if your app is "rooted" if not it maybe translated to something like /MyApp/default.aspx.
If you can translate your path finally - you should have the solution for the problem - or in other words the value you have to set in file explorer.
Regards
Manfred
0
G-Mo
Top achievements
Rank 1
answered on 06 May 2009, 03:26 PM
http://mysite.com is an application.
http://mysite.com/Admin is an application.
http://mysite.com/Assets/Images is the directory I want to reference FROM http://mysite.com/Admin/page.aspx.
MapPath and ResolveUrl from within the nested /Admin applicaton both produce "/Admin/page.aspx".
I want to step BACK a level from /Admin into the parent application (mysite.com in our examples above) to access a directory there...
http://mysite.com/Admin is an application.
http://mysite.com/Assets/Images is the directory I want to reference FROM http://mysite.com/Admin/page.aspx.
MapPath and ResolveUrl from within the nested /Admin applicaton both produce "/Admin/page.aspx".
I want to step BACK a level from /Admin into the parent application (mysite.com in our examples above) to access a directory there...
0
ManniAT
Top achievements
Rank 2
answered on 06 May 2009, 03:48 PM
OK,
I understand your problem now.
You (by default on IIS 6 and 7) can't access parent paths in your application.
There is a setting in IIS (last time I was using this was with "old style" ASP pages) which allows you to access parent paths.
BUT - there is no "only one level" up or such a setting.
So by theory a user could enter something like http://mysite.com/../../../Windows/System32/BadExe.exe :)
Of course there is NTFS security and I guess (really guess - please check the things before you do it!!!!) the risk is not that big as it was in earlier days.
My suggestion for this specific thing - add a virtual directory to your Admin application which points to the Assests dir.
So you have a directory http://mysite.com/Admin/Assests - which points to http://mysite.com/Assests.
This would enable you to access the files there - without the risk of parent paths.
Regards
Manfred
I understand your problem now.
You (by default on IIS 6 and 7) can't access parent paths in your application.
There is a setting in IIS (last time I was using this was with "old style" ASP pages) which allows you to access parent paths.
BUT - there is no "only one level" up or such a setting.
So by theory a user could enter something like http://mysite.com/../../../Windows/System32/BadExe.exe :)
Of course there is NTFS security and I guess (really guess - please check the things before you do it!!!!) the risk is not that big as it was in earlier days.
My suggestion for this specific thing - add a virtual directory to your Admin application which points to the Assests dir.
So you have a directory http://mysite.com/Admin/Assests - which points to http://mysite.com/Assests.
This would enable you to access the files there - without the risk of parent paths.
Regards
Manfred
0
G-Mo
Top achievements
Rank 1
answered on 06 May 2009, 04:55 PM
Virtual Directory does not work... I tried this already... Image Manager opens up blank (/)...
Edit:
Virtual Directories DO work!!
Have to make sure to set it up exactly like the parent app and use /Assets/Images (as opposed to ~/Assets/Images) to guarantee a correct result all round!
0
ManniAT
Top achievements
Rank 2
answered on 06 May 2009, 05:59 PM
Lol,
you've been a bit to fast :)
I just prepared a sample
http://www.pp-p.net/Admin showing that it works.
Just to completed this - I made a virtual /Images directory from the above application.
I'll keep this app (includes some screen shots from IIS manager) online for 2 days.
One last thing - please always REPLY to a thread - use Edit only if you have some typos or things like this.
This is also shown in a "blue box" on top of the edit screen - edit doesn't fire an email notification.
Regards - and good to hear that it finally works
Manfred
you've been a bit to fast :)
I just prepared a sample
http://www.pp-p.net/Admin showing that it works.
Just to completed this - I made a virtual /Images directory from the above application.
<body style="background-color:Silver"> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager runat="server"> |
</telerik:RadScriptManager> |
<div> |
<image src="/Images/IISAdm1.png" /><br /> |
<image src="/Images/IISAdm2.png" /><br /> |
<image src="/Images/IISAdm3.png" /><br /> |
<telerik:RadEditor runat="server" ImageManager-ViewPaths="~/Images" ID="ctl01" Language="de-DE"> |
<Content> |
</Content> |
<ImageManager ViewPaths="~/Images"></ImageManager> |
</telerik:RadEditor> |
</div> |
</form> |
</body> |
I'll keep this app (includes some screen shots from IIS manager) online for 2 days.
One last thing - please always REPLY to a thread - use Edit only if you have some typos or things like this.
This is also shown in a "blue box" on top of the edit screen - edit doesn't fire an email notification.
Regards - and good to hear that it finally works
Manfred