|
Regarding the other post about connectivity.
A simple test for connectivity is the following at the command line.
telnet smtp.gmail.com 587
If the above succeeds you will get a cursor blinking waiting for you to type something (you don't need to type anything, you just need to have it waiting.)
If it doesn't work then it will say something like "connecting..." for a while and then tell you that it timed out, of failed to connect or some other error.
Notice that the above has nothing to do with C# or any other programming language. And until that work nothing you do in C# will make it work.
And I will note that I tried the exact line above and it worked for me. So the host and port are correct.
|
|
|
|
|
Thanks for this ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
PING and TRACERTE can also help you in your issues as well.
If you do a PING SMTP.GMAIL.COM and you get no resolve then you know it is a DNS error in your network.
If you do a PING and you get a resolve but then timeout, you might have a firewall issue.
A TRACERTE (not sure of utility name....sorry) will show you how far you go in connecting to the server. It may stop inside your network or you are getting to the firewall and to an external router but no further. In that case your router isn't forwarding it out to the internet.
Software Zen: delete this;
|
|
|
|
|
i recent develop a project,this use C sharp 4.0,now
need connect to crystal report ,but I will not use the crystal report .
if anyone can offer some advice or learning crystal report example,i would appreciate it.
thanks very much
Ayu
hi Vijjuuuuuuuuu...........
you provide address display error
summary is:page not found
thanks
Ayu
modified on Sunday, September 4, 2011 1:32 AM
|
|
|
|
|
Here[^] is a video tutorial section on Crystal Reports.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
|
hi,Vijjuuuuuuuuu...........
thanks for your answer
Ayu
|
|
|
|
|
C# Crystal Reports step by step
A step by step tutorial for beginners who is creating their Crystal Reports for the first time in C#.
All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb. So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb
Here we are going to create a new Crystal Reports in C# from Product table in the above mentioned database crystalDB. The Product Table has three fields (Product_id,Product_name,Product_price) and we are showing the whole data from Product table to the C# - Crystal Reports project.
Open Visual Studio .NET and select a new CSharp Windows project.
Now you will get the default Form1.cs.
From the main menu in Visual Studio C# project select PROJECT-->Add New Item . Then Add New Item dialogue will appear and select Crystal Reports from the dialogue box.
Select Report type from Crystal Reports gallery.
Accept the default settings and click OK.
Next step is to select the appropriate connection to your database (here crstaldb). Here we are going to select OLEDB Connection for SQL Server to connect Crystal Reports in C#.
Select OLE DB (ADO) from Create New Connection .
Select Microsoft OLE DB Provider for SQL Server .
The next screen is the SQL Server authentication screen for connecting to the database - crystalDB. Select your Sql Server name , enter userid , password and select your Database Name .
Click next , Then the screen shows OLE DB Property values , leave it as it is , and then click finish button.
After you click the finish button , the next window you will get your Server name under OLEDB Connection, from there selected database name (Crystaldb) and click the tables , then you can see all your tables from your database.
From the tables list double click the Product table then you can see the Product table will come in the right side list.
Click Next Button
Select all fields from Product table to the right side list .
Click Finish Button. Then you can see the Crystal Reports designer window in your C# project. In the Crystal Reports designer window you can see the selected fields from Product table. You can arrange the field Objects and design of the screen according your requirements. After that your screen is look like the following picture.
Now the designing part is over and the next step is to call the Crystal Reports in your C# application and view it through Crystal Reports Viewer control in C#.
Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form .
After you drag the CrystalReportViewer to your form , it will look like the following picture.
You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code.
using CrystalDecisions.CrystalReports.Engine;
Copy and paste the following source code and run your C# project
Download Source Code
Print Source Code
using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}
}
}
NOTES:
cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
The Crystal Reports file path in your C# project file location, there you can see CrystalReport1.rpt . So give the full path name of Crystal Reports file like c:\projects\crystalreports\CrystalReport1.rpt
When you run the source code you will get the report like the following picture.
When you click the button, the application will ask the username and password. Later in this tutorial you can find how to avoid asking username and password - C# Dynamic logon parameters in Crystal Reports
|
|
|
|
|
hi,palanidothis
very good, thanks your answer.
thanks!
Ayu
|
|
|
|
|
hi,palanidothis
thanks for your answer.
Ayu
|
|
|
|
|
How can i lock (or encode) my dll file in C# so that cant be decode by reflector or ect.
|
|
|
|
|
You can use one of the various Obfuscators that are available.
However, none of these are absolutely fool proof so there is always a way someone can decode the dll.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
You can't. If you could, how would the CPU know what to do?
You can obfuscate it all you want, but it will never be such that it can't be decoded - not and still be runnable by the computer.
|
|
|
|
|
jojoba2011 wrote: How can i lock (or encode) my dll file in C# so that cant be decode by reflector or ect.
1. Write you code.
2. Compile it to create the dll.
3. Write a server that handles TCP requests by giving them to your dll (step 2.)
4. Write a proxy that sends requests via TCP to your server (step 3.)
5. Set your server up in a secure hosting environment with the correct security policies in place.
6. Distribute the proxy and only the proxy to other people.
|
|
|
|
|
+5; the only way of securing your code is by having it run in a secure environment, merely communicating with the outside world.
MacAfee proved that
Bastard Programmer from Hell
|
|
|
|
|
Hi there!
I have an exception in my senderemail program.
here the code:
private void SendEmail(MailMessage message, MailAddress from)
{
message.Subject = txtTitle.Text;
message.SubjectEncoding = Encoding.UTF8;
message.BodyEncoding = Encoding.UTF8;
SmtpClient smtpClient = new SmtpClient(Properties.Settings.Default.SMTPServer);
smtpClient.EnableSsl = false;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential();
try
{
smtpClient.Send(message);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
message.Dispose();
}
}
but in line "smtpClient.Send(message);" I have the following exception :
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 74.112.253.35:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at EmailSender.EmailSenderForm.SendEmail(MailMessage message, MailAddress from) in
how can I solve it?
|
|
|
|
|
1) check you can ping the mail server's ip address from your computer.
2) use telnet to connect to the ip and port to see if there is an email server there.
*) try removing the ":25" from the address you are specifying.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
|
|
|
|
|
I am using ControlPaint.DrawReversibleFrame to draw a frame while the user clicks/drags on a control. All is well there. Once complete, I do some things with the information, including drawing to the control using rectangle used to draw the frame. However, if I drag backward OR upward, I end up with nothing because it has negative values. How can I correct this? Sorry if I did not explain well enough, I am busy with things at home. But I can elaborate later if necessary.
SOLUTION:
Basic math
if (finalRect.Width < 0)
{
finalRect.X = (finalRect.X + finalRect.Width);
finalRect.Width = Math.Abs(finalRect.Width);
}
if (finalRect.Height < 0)
{
finalRect.Y = (finalRect.Y + finalRect.Height);
finalRect.Height = Math.Abs(finalRect.Height);
}
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
modified on Friday, September 2, 2011 8:54 PM
|
|
|
|
|
i am trying to make the following web code work for a C#.net 2008 desktop application. My company wants us to use the same logic to check groups in the active directory. The following is the code snippet I obtained from the contract.
From the contractor, i also obtained the xml file. The three columns i am referring to are not in the xml file. The fields I am trying to figure out how they are referenced in the app code are the following:
DirectoryEntry
DirectorySearcher
SearchResult.
Would you have any idea what I can use to point to the columns listed above are that I can use in a C#.net 2008 desktop application? if so, can you show me some code and/or point to a url that I can use as a reference?
The following is the code i am trying to work with:i am trying to make the following web code work for a C#.net 2008 desktop application. My company wants us to use the same logic to check groups in the active directory. The following is the code snippet I obtained from the contract.
From the contractor, i also obtained the xml file. The three columns i am referring to are not in the xml file. The fields I am trying to figure out how they are referenced in the app code are the following:
DirectoryEntry
DirectorySearcher
SearchResult.
Would you have any idea what I can use to point to the columns listed above are that I can use in a C#.net 2008 desktop application? if so, can you show me some code and/or point to a url that I can use as a reference?
The following is the code i am trying to work with:
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
namespace Sup
{
public class ActiveDirectoryValidator
{
private string _path;
private string _filterAttribute;
public ActiveDirectoryValidator(string path)
{
_path = path;
}
public bool IsAuthenticated(string domainName, string userName, string password)
{
string domainAndUsername = domainName + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, password);
try
{
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + userName + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
_path = result.Path;
_filterAttribute = (String)result.Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return true;
}
}
}
|
|
|
|
|
|
In the code listed below, is there a way to call the
IsAuthenticated
mehtod without using a password? I do not want to obtain a password for the user since i do not need it for windows authneication and the code is more secure.
public bool IsAuthenticated(string domainName, string userName, string password)
|
|
|
|
|
|
it has been like that the whole week long; people should stop replying till he finally gets it.
|
|
|
|
|
Luc Pattyn wrote: it has been like that the whole week long
I did not know that. I tried to answer the question in all earnest.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
I want to mention the following:
1. Sorry1 If i am formatting the statements incorrectly, can you point me to directions o0n how to format the comments and how to format the code? it looks like the last time I formatted a question, it was formatted exactly like the code block?
How do you format the code separate from comments (statements)?
2. The directory services name space works very well. however the code wants a ldap path. Is that something from code i can find or do I need to find out this ldap path from the network administrator?
|
|
|
|