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!
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.
DotNetNuke® is a registered trademark of DotNetNuke Corporation