Hi,

I'm trying to create a patch for the MailDefinition (System.Web.UI.WebControls) 
and I'm not sure what's the best way to do it. The problem is in the 
CreateMailMessage (string recipients, IDictionary replacements, Control owner) 
method. If the BodyFileName is present and it's rooted everything works fine. 
If it's not rooted, it is combined with the owner's TemplateSourceDirectory. 
And this is not working :(

I'm using the MailDefinition from a CreateUserWizard. Both the aspx containing 
the CreateUserWizard and the mail file are in the same directory, "users". If I 
set the BodyFileName for the wizard to "~/users/createaccount.txt", the 
combined path is something like this: "/myapp/~/users/createaccount.txt". And 
this is because there's no check for "~/".

If I set the BodyFileName to "createaccount.txt", the combined path is 
something like this: "/myapp/users/createaccount.txt". This one looks fine, 
except that it's a virtual path and the StreamReader in the CreateMailMessage 
is looking for a physical path.

How should be the mail file accessed? Using virtual paths or physical paths? 
Also, what about the permissions of the mail file?

P.S. Attached is a sample error.

Thanks & best regards,
Dumi.

Server Error in '/myapp' Application
Could not find a part of the path "/myapp/users/createaccount.txt".

Description: Error processing request.

Error Message: HTTP 500. System.IO.DirectoryNotFoundException: Could not find a 
part of the path "/myapp/users/createaccount.txt".

Stack Trace:

System.IO.DirectoryNotFoundException: Could not find a part of the path 
"/myapp/users/createaccount.txt".
  at System.IO.FileStream..ctor (System.String name, FileMode mode, FileAccess 
access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions 
options) [0x00000] 
  at System.IO.FileStream..ctor (System.String name, FileMode mode, FileAccess 
access, FileShare share) [0x00000] 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor 
(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] 
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding 
encoding, Boolean detect_encoding_from_bytemarks, Int32 buffer_size) [0x00000] 
  at System.IO.StreamReader..ctor (System.String path) [0x00000] 
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
  at System.Web.UI.WebControls.MailDefinition.CreateMailMessage (System.String 
recipients, IDictionary replacements, System.Web.UI.Control owner) [0x00000] 
  at System.Web.UI.WebControls.CreateUserWizard.SendPasswordByMail 
(System.Web.Security.MembershipUser user, System.String password) [0x00000] 
  at System.Web.UI.WebControls.CreateUserWizard.CreateUser () [0x00000] 
  at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick 
(System.Web.UI.WebControls.WizardNavigationEventArgs e) [0x00000] 
  at System.Web.UI.WebControls.Wizard.ProcessEvent (System.String commandName, 
System.String commandArg) [0x00000] 
  at System.Web.UI.WebControls.Wizard.OnBubbleEvent (System.Object source, 
System.EventArgs e) [0x00000] 
  at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent (System.Object 
source, System.EventArgs e) [0x00000] 
  at System.Web.UI.Control.RaiseBubbleEvent (System.Object source, 
System.EventArgs args) [0x00000] 
  at System.Web.UI.WebControls.Button.OnCommand 
(System.Web.UI.WebControls.CommandEventArgs e) [0x00000] 
  at System.Web.UI.WebControls.Button.RaisePostBackEvent (System.String 
eventArgument) [0x00000] 
  at 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
 (System.String eventArgument) [0x00000] 
  at System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler 
sourceControl, System.String eventArgument) [0x00000] 
  at System.Web.UI.Page.RaisePostBackEvents () [0x00000] 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) 
[0x00000] 

5/29/2007 6:47:13 AM 
_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to