|
That's definitely a problem with your DNS servers. You'll need to talk to whoever's in charge of your infrastructure to resolve the problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Fraol Gelana wrote: System.Net.WebException: The remote name could not be resolved
Check your DNS settings, and make sure you can resolve "smtp.mail.yahoo.com".
Open a command-prompt, type nslookup smtp.mail.yahoo.com, and then press Return. The response should look something like:
Non-authoritative answer:
Name: smtp.mail.eu.am0.yahoodns.net
Address: 188.125.69.59
Aliases: smtp.mail.yahoo.com
smtp.mail.global.gm0.yahoodns.net
fo-smtp.mail.eu.am0.yahoodns.net
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
First step is to put a break-point on:
using (MailMessage mail = new MailMessage())
and single-step (F11) through the code, examining the state/value of all variables as each line is executed. This may help you identify exactly what's failing.
May I suggest you take out your "real" e-mail address from your post: posting real e-mail addresses here is likely to get you spammed because of various evil things running about the net.
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
BillWoodruff wrote: First step is to put a break-point on:
I would suspect strongly that the exception that says "The remote name could not be resolved" pretty much resolves the problem. And debugging it isn't going to change that.
Could it mean something else?
|
|
|
|
|
The code looks good, and should work. The message
Fraol Gelana wrote: System.Net.Mail.SmtpException:Failure sending mail. --->
System.Net.WebException: The remote name could not be resolved does point toward a problem with your network configuration. If you're at work you should try to contact your IT departement to resolve the issue, if you have a "home-environment" I recommend you to check your router's settings - Some have an internal firewall or blacklist.
Another approach would be to install Thunderbird[^] - Configure the email account, and if Thunderbird can't connect to Yahoo either there clearly must be an error with the network.
The console is a black place
|
|
|
|
|
How To Create Data Recovery in C#.net windows application that will recovery all the data from hard disk or removable drive which consists of Images,media files and other files.
|
|
|
|
|
That depends entirely on what your definition of "Data Recovery" is. That's a broad term and you haven't defined the condition under which data is lost and can be recovered.
Without that, you have no hope of completing the project.
You already posted this question in QA. Pick ONE forum and post the question ONCE.
|
|
|
|
|
Hi to everyone.
I know that there are a lot of articles in the internet about this problem. I know that there is KeepWith property and i read here http://forum.pdfsharp.net/viewtopic.php?f=2&t=679[^]
http://forum.pdfsharp.net/viewtopic.php?p=6852#p7408[^]
that it should work if i install assemblies http://www.pakeha_by.my-webs.org/MigraDocFastTableRender.html[^]
I installed and there is no effect, anyway i try to use it - my table is cut on one page((( and other rows do not go to the next page....
My way coding tables
PdfDocument outputDocument = new PdfDocument();
PdfPage editablePage = outputDocument.AddPage();
editablePage.Size = PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(editablePage);
MigraDoc.DocumentObjectModel.Document doc3 = new MigraDoc.DocumentObjectModel.Document();
MigraDoc.DocumentObjectModel.Tables.Table table3 = new MigraDoc.DocumentObjectModel.Tables.Table();
Column column3 = table3.AddColumn(70);
column3.Format.Alignment = ParagraphAlignment.Left;
column3.Format.Font.Bold = false;
column3 = table3.AddColumn(50);
column3.Format.Alignment = ParagraphAlignment.Center;
column3.Format.Font.Bold = false;
Row row3 = table3.AddRow();
row3.Format.Alignment = ParagraphAlignment.Center;
row3.Format.Font.Bold = true;
row3.Format.Font.Size = 9;
row3[0].AddParagraph("Serial");
row3[1].AddParagraph("Time");
...............................................................
...............................................................
while (reader1.Read())
{
row3 = table3.AddRow();
row3[0].AddParagraph(Convert.ToString(reader1.GetValue(0)));
row3[1].AddParagraph(Convert.ToString(reader1.GetValue(1)));
}
...............................................................
...............................................................
table3.Rows[0].KeepWith = table3.Rows.Count-1;
doc3.AddSection().Add(table3);
DocumentRenderer docRenderer3 = new DocumentRenderer(doc3);
docRenderer3.PrepareDocument();
docRenderer3.RenderObject(gfx, 50, 0, 0, table3);
May be this way of constructing tables does not provide my requirements?
I will appreciate any help, thank you.
modified 13-Nov-14 12:30pm.
|
|
|
|
|
It seems i am alone here
Hey...Where are you cyberpeople?
|
|
|
|
|
PDFSharp is not a universally used tool, you might be better served but getting in their forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hi,
I am trying to send email message in C# using this MSDN article:
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient(v=vs.110).aspx
but I am getting this error:
Cannot access a disposed object. Object name : System.Net.Mail.MailMessage
can anyone help please...
private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
String token = (string)e.UserState;
if (e.Cancelled)
{
Console.WriteLine("[{0}] Send canceled.", token);
}
if (e.Error != null)
{
MessageBox.Show(String.Format("[{0}] {1}", token, e.Error.ToString()));
}
else
{
Console.WriteLine("Message sent.");
}
mailSent = true;
}
private static void send_message()
{
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587;
client.Credentials = new System.Net.NetworkCredential("it@mydomain.com", "my_password");
client.EnableSsl = true;
MailAddress from = new MailAddress("it@mydomain.com", "My" + (char)0xD8 + " Company", System.Text.Encoding.UTF8);
MailAddress to = new MailAddress("jassim@mydomain.com");
MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";
string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
message.Body += Environment.NewLine + someArrows;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1" + someArrows;
message.SubjectEncoding = System.Text.Encoding.UTF8;
client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
string userState = "test message1";
client.SendAsync(message, userState);
Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
string answer = Console.ReadLine();
message.Dispose();
Console.WriteLine("Goodbye.");
}
private void btnSend_Click(object sender, EventArgs e)
{
if (XtraMessageBox.Show("Are you sure you want to send this message to all contacts now?", "Send", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
send_message();
}
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
And, why haven't you inserted a break-point, and used F11 to single-step through the code and locate the error ?
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
I guess it is caused by the combination of
client.SendAsync(message, userState);
message.Dispose();
Because of the async part, that function returns immediately, though the process of sending may not even have started. But now you call Dispose on the message object which is still to be sent / being sent.
I suggest to remove the message.Dispose line.
|
|
|
|
|
The error is at
client.SendAsync(message, userState);
Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
string answer = Console.ReadLine();
message.Dispose();
SendAsync does nothing else than sending the message asynchronously, meaning that at the point you dispose the message , the asynchrobnous send routine is still trying to access the message object. Leave away the dispose part, since the message is automatically disposed by the Garbage Collector once it isn't in use anymore.
The console is a black place
|
|
|
|
|
|
Read the forum posting guidelines here. This is not a question, and not appropriate for this forum.
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
Most barcode readers will return the barcode data in text form, so you don't need to do a lot of programming to work with them.
|
|
|
|
|
+5
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Thanks. Amazing how many people ask how to program their reader before even investigating which one they are going to buy.
|
|
|
|
|
True. I remember years ago having to include support for a barcode reader and my initial thoughts were "Great, now I have to learn how to interface with another device." Turns out it just returned it as text to whatever control had focus.
Too easy. No coding required.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am trying to get this VB code to a C# code, and I know I need to use ToString, but I cannot get the code to run correctly, it gives errors for everything. The code is a cartitem and its trying to get the quantity and adding the product price to it, here is what I have:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class CartItem
{
public Product Product;
public int Quantity;
public string Display()
{
return (Product.Name + (" ("
+ (Quantity.ToString() + (" at "
+ (FormatCurrency(Product.UnitPrice) + " each)")))));
}
}
|
|
|
|
|
Probably no for "everything".
C# does not have a "FormatCurrency" function. It does not have functions at all. You will have to find some C# way to format the unitprice.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You can format currency like this:
decimal value = -19230023.33M;
string format = string.Format("{0:C}", value);
|
|
|
|
|
You could create an extension method that returns the value formatted as a currency.
string currency = value.FormattedCurrency();
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|