I'm using Server.MapPath and it's working for me -
<snippet>
// Logging and Configuration constants
private const string EVT_PROGRAMNAME = "TekGuard
WebMail";
private const string DIR_PATHPUBLIC =
"TGWebMail\\Pub\\";
// Internal Constants
internal const string APP_PATHPUBLIC = "PathPublic";
internal const string SES_USERNAME = "UserName";
internal const string SES_PATHUSER = "PathUser";
protected void Application_Start(Object sender, EventArgs e)
{
// Create the application level data path object
string PathServer = Server.MapPath("~/");
// Get the full path of the public directory
// m_PublicPath = PathServer + DIR_PATHPUBLIC; // Root of
virtual web
m_PublicPath = Directory.GetDirectoryRoot(PathServer) +
DIR_PATHPUBLIC;
// Do I have directory storage permission, etc?
try
{
if (!Directory.Exists(m_PublicPath))
Directory.CreateDirectory(m_PublicPath);
// Create the application level data path object; Store the
path for page use
Application.Add(APP_PATHPUBLIC, PathPublic);
}
catch(Exception ex)
{
// m_LogTools.WriteWinAppEvent ("Error setting bootstrap
initialization settings (see log file for details), " + ex.Message,
EventLogEntryType.Error);
Response.Write (EVT_PROGRAMNAME + ": " + ex.Message);
throw new ApplicationException(EVT_PROGRAMNAME + ": " +
ex.Message);
}
}
internal static bool
UserInit(System.Web.SessionState.HttpSessionState Session, object
UserName, object ServerName)
{
// Create the fully qualified directory path for this user
string PathUser = m_PublicPath + ServerName.ToString().ToLower()
+ "\\" + UserName.ToString().ToLower() + "\\";
// Do I have directory storage permission, etc?
try
{
if (!Directory.Exists(PathUser))
Directory.CreateDirectory(PathUser);
Session.Add(SES_PATHUSER, PathUser);
return (true);
}
catch
{
}
return (false);
}
private void Page_Load(object sender, System.EventArgs e)
{
// Load default identity data from XML
path = Session[Global.SES_PATHUSER].ToString()
...
...
...
}
</snippet>
www.VoiceInfo.com - <a href="http://www.VoiceInfo.com">
Virtual Office, Automated Phone Assistant, Web Access </a><br>
www.TekGuard.com - <a href="http://www.TekGuard.com">
Free Mail Server, Outlook PlugIn, WebMail, Source Code </a>