Stefan Cullmann wrote
Place the aspx file inside your module directory and adjuth your pathes that it searches your images at ~/desktopmodules/yourmodule instead of ~/custompages.
Then you can treat the aspx inside the dnn file like all other files.
More comfortable :
// /DesktopModules/CustomModule/ViewCustomModule.ascx.cs
public static string ResolveDesktopModuleUrl(DotNetNuke.Entities.Modules.PortalModuleBase portalModule, string relativePath)
{
return ResolveDesktopModuleUrl(portalModule, relativePath, null);
}
public static string ResolveDesktopModuleUrl(DotNetNuke.Entities.Modules.PortalModuleBase portalModule, string relativePath, string fileName)
{
if (portalModule == null) throw new ArgumentNullException("portalModule");
return ResolveDesktopModuleUrl(portalModule.ModuleId, portalModule.TabId, relativePath, fileName);
}
public static string ResolveDesktopModuleUrl(int moduleId, int tabId, string relativePath, string fileName)
{
const string DESKTOP_MODULES_FOLDER_NAME = "/DesktopModules/";
DotNetNuke.Entities.Modules.ModuleController moduleController = new DotNetNuke.Entities.Modules.ModuleController();
DotNetNuke.Entities.Modules.DesktopModuleController desktopModuleController = new DotNetNuke.Entities.Modules.DesktopModuleController();
DotNetNuke.Entities.Modules.ModuleInfo moduleInfo = moduleController.GetModule(moduleId, tabId);
DotNetNuke.Entities.Modules.DesktopModuleInfo desktopModuleInfo = desktopModuleController.GetDesktopModule(moduleInfo.DesktopModuleID);
if (string.IsNullOrEmpty(relativePath) == false)
{
if (relativePath.StartsWith("/") == false) relativePath = "/" + relativePath;
if (string.IsNullOrEmpty(fileName) == false)
{
if (relativePath.EndsWith("/") && fileName.StartsWith("/"))
{
relativePath = relativePath.Remove(relativePath.Length - 1);
}
else if (relativePath.EndsWith("/") == false && fileName.StartsWith("/") == false)
{
relativePath += "/";
}
return Globals.ResolveUrl(DotNetNuke.Common.Globals.ApplicationPath + DESKTOP_MODULES_FOLDER_NAME + desktopModuleInfo.FolderName + relativePath + fileName);
}
return Globals.ResolveUrl(DotNetNuke.Common.Globals.ApplicationPath + DESKTOP_MODULES_FOLDER_NAME + desktopModuleInfo.FolderName + relativePath);
}
else
{
if (string.IsNullOrEmpty(fileName) == false)
{
if (fileName.StartsWith("/") == false)
{
fileName = "/" + fileName;
}
return Globals.ResolveUrl(DotNetNuke.Common.Globals.ApplicationPath + DESKTOP_MODULES_FOLDER_NAME + desktopModuleInfo.FolderName + fileName);
}
}
return Globals.ResolveUrl(DotNetNuke.Common.Globals.ApplicationPath + DESKTOP_MODULES_FOLDER_NAME + desktopModuleInfo.FolderName);
}
Usage:
string pageUrl = ResolveDesktopModuleUrl(this,"SomePage.aspx");
resolved to /DesktopModules/CustomModule/SomePage.aspx
![](/Providers/HtmlEditorProviders/Fck/FCKeditor/editor/images/smiley/msn/wink_smile.gif)