Click here to Skip to main content
15,901,205 members
Home / Discussions / C#
   

C#

 
GeneralRe: Label update Pin
imnotso#30-Jan-07 23:17
imnotso#30-Jan-07 23:17 
Questionconvert c# to vb.net Pin
Doritkatz30-Jan-07 1:00
Doritkatz30-Jan-07 1:00 
AnswerRe: convert c# to vb.net Pin
andre_swnpl30-Jan-07 1:19
andre_swnpl30-Jan-07 1:19 
GeneralRe: convert c# to vb.net Pin
Doritkatz30-Jan-07 1:55
Doritkatz30-Jan-07 1:55 
AnswerRe: convert c# to vb.net Pin
Pete O'Hanlon30-Jan-07 1:20
mvePete O'Hanlon30-Jan-07 1:20 
GeneralRe: convert c# to vb.net Pin
Martin#30-Jan-07 1:32
Martin#30-Jan-07 1:32 
AnswerRe: convert c# to vb.net Pin
Dave Doknjas30-Jan-07 13:42
Dave Doknjas30-Jan-07 13:42 
QuestionSending a crypt Email with Attachment Pin
olivier29-Jan-07 23:37
olivier29-Jan-07 23:37 
Hello

I want to send a crypted email with a certificate and a word attachment file.
So I have created a MailMessage and I have crypted my Word Document with my Certificate.
Then I have created and alternate View with the crypted attachment.
When I receive the mail, my mail is well cryped and the attachment is in the mail (icons are displayed in outlook)

The problem is that the attachment is opened in the body of the mail just like Text (So i can see all the word specific data).
I cannot see the word as an attachment and to save it.

Any Help is welcomed Smile | :)

      <br />
MailMessage eMail = new MailMessage();<br />
eMail.From = new MailAddress("MyMail@MyCompany.com");<br />
eMail.To.Add(new MailAddress("MyMail@MyCompany.com"));<br />
eMail.Subject = "Test";<br />
SmtpClient Smtp = new SmtpClient("MyCompany.com")<br />
<br />
#region crypt<br />
<br />
X509Certificate2 myCertificat = new X509Certificate2(@".\MyCert.cer", "xxxx");<br />
System.IO.Stream myFile = null;<br />
myFile = new System.IO.FileStream(@".\Test.doc", System.IO.FileMode.Open,System.IO.FileAccess.Read);<br />
byte[] data = new byte[myFile.Length];<br />
myFile.Read(data, 0, (int)myFile.Length);<br />
<br />
ContentInfo contentInfoCrypt = new ContentInfo(data);<br />
EnvelopedCms envelopedCms = new EnvelopedCms(contentInfoCrypt);<br />
CmsRecipient recip1 = new CmsRecipient(myCertificat);<br />
envelopedCms.Encrypt(recip1);<br />
envelopedCms.Certificates.Add(myCertificat);<br />
byte[] encryptbytes = envelopedCms.Encode();<br />
#endregion<br />
<br />
MemoryStream mss = new MemoryStream(encryptbytes);<br />
<br />
AlternateView av = new AlternateView(mss, "application/x-pkcs7-mime; smime-type=enveloped-data; name=smime.p7m;");<br />
eMail.AlternateViews.Add(av);<br />
Smtp.Send(eMail);<br />

QuestionGet File Name Pin
ParimalaRadjaram29-Jan-07 23:26
ParimalaRadjaram29-Jan-07 23:26 
AnswerRe: Get File Name Pin
Pete O'Hanlon29-Jan-07 23:33
mvePete O'Hanlon29-Jan-07 23:33 
GeneralRe: Get File Name Pin
ParimalaRadjaram29-Jan-07 23:35
ParimalaRadjaram29-Jan-07 23:35 
GeneralRe: Get File Name Pin
bobsugar22229-Jan-07 23:39
bobsugar22229-Jan-07 23:39 
GeneralRe: Get File Name Pin
ParimalaRadjaram29-Jan-07 23:41
ParimalaRadjaram29-Jan-07 23:41 
GeneralRe: Get File Name Pin
bobsugar22229-Jan-07 23:59
bobsugar22229-Jan-07 23:59 
AnswerRe: Get File Name Pin
engsrini30-Jan-07 0:47
engsrini30-Jan-07 0:47 
GeneralRe: Get File Name Pin
ParimalaRadjaram30-Jan-07 2:51
ParimalaRadjaram30-Jan-07 2:51 
AnswerRe: Get File Name Pin
greenpci30-Jan-07 1:54
greenpci30-Jan-07 1:54 
GeneralRe: Get File Name Pin
ParimalaRadjaram30-Jan-07 2:55
ParimalaRadjaram30-Jan-07 2:55 
GeneralRe: Get File Name Pin
ParimalaRadjaram30-Jan-07 17:48
ParimalaRadjaram30-Jan-07 17:48 
AnswerRe: Get File Name Pin
PavanPareta30-Jan-07 2:58
PavanPareta30-Jan-07 2:58 
GeneralRe: Get File Name Pin
Pete O'Hanlon30-Jan-07 3:52
mvePete O'Hanlon30-Jan-07 3:52 
QuestionListBox as a DataGrid Cell Pin
karthik Tamizhmathi29-Jan-07 22:57
karthik Tamizhmathi29-Jan-07 22:57 
AnswerRe: ListBox as a DataGrid Cell Pin
blue_arc30-Jan-07 1:26
blue_arc30-Jan-07 1:26 
GeneralRe: ListBox as a DataGrid Cell Pin
karthik Tamizhmathi30-Jan-07 1:42
karthik Tamizhmathi30-Jan-07 1:42 
AnswerRe: ListBox as a DataGrid Cell Pin
Mircea Puiu30-Jan-07 4:15
Mircea Puiu30-Jan-07 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.