Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Help with a file

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
jncraig
Posts:79



08/13/2007 8:25 AM  

In my module, I want to read a block of text from a file that is in the module's directory (Desktop Modules/myModule). 

I'm having trouble getting the right path to the file so that File.OpenText can find it.

Help!

John Mitchell
Posts:3248



08/13/2007 9:35 AM  

Hi Joe,

If the code-behind is running for an ascx file that is in the module's folder then you can use Me.TemplateSourceDirectory or Me.ResolveUrl() to get the virtual path. ResolveUrl actually just returns the TemplateSourceDirectory property.

http://msdn2.microsoft.com/en-us/library/system.web.ui.control.templatesourcedirectory.aspx

http://msdn2.microsoft.com/en-us/library/system.web.ui.control.resolveurl.aspx

Then you can use Server.MapPath to get the actual physical folder.

 

jncraig
Posts:79



08/14/2007 6:54 AM  
Thanks!

(do you have any favorite references for finding stuff in the seemingly endless set of class libraries?)
John Mitchell
Posts:3248



08/14/2007 10:04 AM  
Sometimes I'll just use google to search MSDN by adding site:msdn2.microsoft.com to my search parameters.

I happened to know that one off the top of my head so it was a little easier, but if you spend a little time with the high-level namespaces you can usually guess what namespace the code method or class you are looking for will be in, which helps to narrow it down.
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.




ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

Item codeXDAkuna
AuthorNina Meiers
Price$49.00
Product Information