Solved

Alternative to a reporting tool?

Posted on 2011-09-26
10
180 Views
Last Modified: 2012-08-14
I'm up against a deadline and am having way too much difficulty finding a simple free reporting solution to my ASP .NET 3.5 [C#] web application. So in an effort to "come up with something" i'm now playing with  the idea of creating a formatted message and just sending that formatted message through an email. So,...I'm now looking for code examples or links that point to examples of how to do this? Any help would be appreciated. If it adds any help to the solution, i'm running my web app from / through a goDaddy server. Thanks.
0
Comment
Question by:mikesExpertExchange
  • 6
  • 4
10 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 36599859
here's a simple tutorial on how to send emails:

http://www.systemwebmail.com/faq/2.2.aspx
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 36599878
if you need to use authentication, this thread also explains it well:

http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36600873
@The Big Daddy: so how do i make sure that I'm set up correctly to send email from my HostIPAddress or smptserver? i'm getting a socket operation error: "A socket operation was attempted to an unreachable network xxx.xxx.x.x:25". and for some reason there is a :25 attached to the end of my IP octet. Not sure why or what this error means. I went and ran the "ipconfig /all" command from the command prompt to get my DNS server IP address. and when i put that in my code for my local host, as in the sample code above, it bombed out with the error mentioned above.

i had to alter the code a bit,...(see code attached). i set the HostIPAddress to the ip address i found when i ran the ipconfig /all command
MailAddress toAddress = new MailAddress("toAddress@gmail.com");
        MailAddress fromAddress = new MailAddress("fromAddress@gmail.com");

        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(fromAddress, toAddress);
        //mail.To.Add(toAddress);
        //mail.From.Address;
        mail.Subject = "this is a test email.";
        mail.IsBodyHtml = true;
        mail.Body = "this is my test email body.<br><b>this part is in bold</b>";

        using (SmtpClient client = new SmtpClient(String.IsNullOrEmpty(smtpserver) ? HostIPAddress : smtpserver)) //your real server goes here
        {
            client.Send(mail);

        }

Open in new window

0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 36601080
since you're hosting on GoDaddy, you'll need to use their servers to send out the email. After some digging around, I found this article:

http://help.godaddy.com/article/1073

Note you cant use gMail addresses to send emails.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601330
ok,...I will check that link for when I start testing on goDaddy. for now, the problem I described above, is happening as I try to test the code on my machine, my laptop. I'm using a wireless connection, if that makes any difference.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601656
this is the copied and pasted text of the error i'm getting (see code snippet). above, when you mentioned that i couldn't send email from my gMail account, was that pertaining only to if i was / would be trying to send an e-mail through the goDaddy server(s)?
Server Error in '/' Application.
A socket operation was attempted to an unreachable network xxx.xxx.x.xxx:25
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 192.168.1.100:25

Source Error:

Line 1607:        SmtpClient client = new SmtpClient(HostIPAddress); //your real server goes here
Line 1608:
Line 1609:            client.Send(mail);
Line 1610:
Line 1611:        if (rbtnLockPassword.Checked)


Source File: c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs    Line: 1609

Stack Trace:

[SocketException (0x2743): A socket operation was attempted to an unreachable network 192.168.1.100:25]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
   System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebException: Unable to connect to the remote server]
   System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5495895
   System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
   System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
   System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332
   System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +160
   System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
   System.Net.Mail.SmtpClient.GetConnection() +35
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1213

[SmtpException: Failure sending mail.]
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
   _Default.StudentSignInOut() in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1609
   _Default.btnSignIn_click(Object sender, EventArgs e) in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1540
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 36601827
thats correct, GD doesnt allow it for some reason.

the error you're getting is basically saying the address you provided is incorrect. Whether its the port number(25) thats throwing it off or just the wrong IP, im not sure, you'll have to play around with it. did you try using just localhost as your address with the latest example I gave you?
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601835
if you mean actually putting in the string: "localhost" no i didn't / haven't. but i will now and let you know what happens...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601929
i got a transport error when i tried it with "localhost"
Server Error in '/' Application.
The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.


Source Error:

Line 1610:        SmtpMail.SmtpServer = "localhost"; //your real server goes here
Line 1611:
Line 1612:        SmtpMail.Send(mail);
Line 1613:        
Line 1614:


Source File: c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs    Line: 1612

Stack Trace:

[COMException (0x80040213): The transport failed to connect to the server.
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
   System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +337
   System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) +36
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) +66
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +49

[HttpException (0x80004005): The transport failed to connect to the server.
]
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +99
   System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1738
   System.Web.Mail.SmtpMail.Send(MailMessage message) +273
   _Default.StudentSignInOut() in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1612
   _Default.btnSignIn_click(Object sender, EventArgs e) in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1540
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

Open in new window

0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 36967986
thanks for your help
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question