[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    [Mono-dev] MailDefinition patch
From:       "Dumitru Ban" <dban () dako ! ro>
Date:       2007-05-29 8:14:18
Message-ID: 003201c7a1c9$6cc09f90$f265a8c0 () laptopdban
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16441" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>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 :(</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I'm using the MailDefinition from a 
CreateUserWizard. Both the aspx containing the CreateUserWizard and the mail 
file are in the same directory, "users".&nbsp;I</FONT><FONT face=Arial size=2>f 
I set the BodyFileName&nbsp;for the wizard&nbsp;to "~/users/createaccount.txt", 
the combined path is something like this: "/myapp/~/users/createaccount.txt". 
And this is because there's no check for "~/".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>How should be the mail file accessed? Using virtual 
paths or physical paths? Also, what about the permissions of the mail 
file?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>P.S. Attached is a sample error.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks &amp; best regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Dumi.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>

["maildefinition.txt" (text/plain)]

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
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic