how use Server.Path in ITREE class Options
lpastor
Posted: Friday, October 10, 2008 9:40:53 AM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
Hi

I crate class that is based on ITREE umbraco interface
and when I want in it to user Server.MathPath(); he cannot recognize the library????

Why ? and is there any other possibility ...I need to red files from folder under umbraco files system?


HELP
DeNY
Posted: Friday, October 10, 2008 11:53:54 AM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 39
Did you check HttpContext.Current ? May be you must read msdn in order to understand why class can not recognize library?
lpastor
Posted: Friday, October 10, 2008 12:18:52 PM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
Hi DeNY

can you declare that this answer can help me in any ... way Applause

If you can not give me a answer that you don't write a post

thanks anyway

Dirk
Posted: Friday, October 10, 2008 12:28:32 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

@All: Please keep a friendly tone in here.

A forum is here to help people, even if some questions may sound completely 'stupid' to others. Don't expect others to have the same knowledge, that is why we have such a great community. We'd like to keep it that way!

@lpastor: I bit of agree with DeNy that you should at least perform a google search... Both DeNy and myself have given a similar answer to your post, so I guess we've given some pointers here.

Good luck!

Regards,
/Dirk



level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
lpastor
Posted: Friday, October 10, 2008 12:42:05 PM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
Ok,
I agree with you ... maybe today have bitchy attitude... it is my delivery day :-(

so maybe this is a reason why I cannot found anything on Google... DeNY give me a great help with creation of new section in backed... so sorry if my previous answer was to personal...

you both have a bigger experience but I came in community when I try everything by my own without success...

I even look in media cs where I suppose that Umrabo have to read fome folder from HDD but I cannot see how they refence to path under umrabo site in ITREE class...

so must isomthing in a Friday

DeNY
Posted: Friday, October 10, 2008 1:32:09 PM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 39
Hi lpastor

Sorry for my impolite answer but this problem really can be solved just by checking msdn or google.

So about the topic, waht exaclty problem do you have? Server is not a class name - but the property name of the UserControl class(actual class name is HttpServerUtility).
Our node tree handler doesnt inherits UserControl(or Page class) - so we doesnt have the access to the Server property. As i wrote above the instance of the HttpContext class will help us to access HttpServerUtility from another place rather than page or user control. In other words this will be in this way - HttpContext.Current.Server.MapPath().
In this variant you clients or you will place pdf files direclty on the web server and this code will show them at the umbraco admin.

Another way as i mentioned at the prevous topic - is to let user to put pfd files at the media section (like they uplaod images).
In this case we will not depend on files path but just refrence to pdf file with umbraco api (direct node access or using class Media).

You can choose any variant you like.
Please try it and if you have any more questions will try to help in solving it.

lpastor
Posted: Friday, October 10, 2008 3:15:07 PM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
Hi DeNY

first I want to apologize for my answer , I'm realy sorry.
About HttpContext.Current.Server.MapPath() , and yes I going to test that ... but first I have to deploy application (today is my dead line ) so Yes you give me a couple solution ... but my idea was to have a link to pdf file in tree node (I menage that thanks to you :-))
problem ...how to set a path to fisical folder where I store pdf files..
yes one solution is to put in config file sme values

I cannot use "....et user to put pfd files at the media section (like they uplaod images).
In this case we will not depend on files path but just refrence to pdf file with umbraco api (direct node access or using class Media)...."
becouse this pdf file is Crystal report about some data in DataBase and when user export it this PDF files will be stored fisicly in some folder under web site tree (user dont participate in this action) and my idea was to aloww user to see this pdf file in some other sections called Report...
Fill tree with files reference and when he click on one node show pdf file in right window...
This was also a problem becouse showing pdf document in asp.net page require workinh with "response" and I get a error "this interfece is not alowed" ??? probably problem with Ajax call .but my solution is to just show a link to that pdf and open it in new window ...similar like umbraco do if you put file in media section...

I ;m not to happy with this solution but it works... just whant to path to that folder make relative insted of call it by full path name...

And yes I'm going to see the code and figure out how to mace that tab in right window :-)


thaks one more time ... see you




lpastor
Posted: Tuesday, October 14, 2008 2:11:00 PM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
hi DeNY

HttpContext.Current.Server.MapPath() is working ... I just was stupid like a nob


cheers
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.