|
My VS2003 web application written in VB.NET works as required on my XP Pro desktop platform using .Net Framework 1.1, IIS 6.0 a local MSDE database. It uses System.Web.Mail to send emails via my ISP's web server which requires authentication. Everything works fine. Emails are sent ok.
However, when I migrate the application to my separate web server (Windows Server 2003, .Net Framework 1.1, IIS 6.0 ) and my separate database server (Windows Server 2000, SQL Server) the emails are not sent and I get the message "The transport failed to connect to the server."
Could this be a configuration issue with my web server? Or could it be the SMTP access coded in VB is missing something that is defaulted to on my desktop platform?
My VB code is as follows:-
Dim strBody As String
Dim msgEmail As MailMessage = New MailMessage
' provide external mail server with authentication for outgoing mail
Dim strUserName As String = "myname@MyEmail.com"
Dim strPassword As String = "MyPassword"
Dim intCdoBasic As Integer = 1
msgEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", intCdoBasic)
msgEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", strUserName)
msgEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", strPassword)
msgEmail.Subject = "My Subject: "
msgEmail.BodyFormat = MailFormat.Html
msgEmail.Body = BuildBody() 'build html and copy to body
msgEmail.To = "TargetName@TargetDomain.com"
msgEmail.Priority = MailPriority.High
msgEmail.From = “SourceName@Domain.com”
SmtpMail.SmtpServer = "mail.MyISP.com" 'as provided by ISP
System.Web.Mail.SmtpMail.Send(msgEmail)
I get the following error stack:-
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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
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 invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +58
[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1848
System.Web.Mail.SmtpMail.Send(MailMessage message) +150
OMOT_booking.SubmitRequest.SendPayReq(String strIref)
OMOT_booking.SubmitRequest.btnNext_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +108
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1292
modified on Friday, February 15, 2008 11:06 AM
|
|
|
|
|
There's probably nothing wrong with the code. The problem is probably being caused by your ISP or a firewall in the way between where your code is running and the SMTP server.
Most ISP's won't let you send an email using their servers if the request comes from outside their network. This means that your code would work perfrectly from home, but once you move the code to a hosting facility outside your ISP's network, you can no longer get at their SMTP servers. There is no way around this problem. You'll have to use a different SMTP server.
Check for firewall's blocking traffic on both the inbound and outbound sides of the network connection between your hosting server and your ISP's SMTP server. Make sure the appropriate ports are opened on both sides.
Also, make sure that your ISP's DNS name for the SMTP server is resolvable by the server hosting your app. If it's not, there's nothing you can do about it, other than using a different SMTP server.
|
|
|
|
|
Thanks for your comments Dave. I will bear them in mind as I do plan to migrate my application to a web hosting ISP and I had not anticipated any problem calling my existing ISP's SMTP server.
However, my immediate problems concern my home network only. I have both an XP Pro development platform AND a home network that includes a web server box and a database server box.
I have investigated the differences in configuration and noticed that my desktop's IIS has a "Default SMTP Virtual Server" directory whilst that on my Win 2003 server does not. So I have concluded that the email service (IIS optional feature) on my Win Server 2003 box has has not been installed yet. I assume this service must be installed to provide a "virtual SMTP" server to communicate with my ISP's SMTP server. So, I am installing the IIS email service but it is taking forever.
Do you think this will fix my problem?
|
|
|
|
|
Stortman wrote: I have investigated the differences in configuration and noticed that my desktop's IIS has a "Default SMTP Virtual Server" directory whilst that on my Win 2003 server does not. So I have concluded that the email service (IIS optional feature) on my Win Server 2003 box has has not been installed yet. I assume this service must be installed to provide a "virtual SMTP" server to communicate with my ISP's SMTP server. So, I am installing the IIS email service but it is taking forever.
Do you think this will fix my problem?
Maybe, but not likely, because you're not using your local SMTP server at all. Also, most ISP's won't forward mail from unauthorized SMTP servers (like yours) anyway because of the proliferation of spam.
You MAY get the benefit of having libraries installed that may solve your problem, but I doubt it.
|
|
|
|
|
I have now successfully installed the optional email service that was not included when I originally installed the web server (IIS 6.0) on my Win 2003 server box.
I have also checked out my hardware firewall NAT settings (Draytek Vigor) and opened port 25 for the server box's IP address.
Now, when I test across the public internet, the web application's email feature works correctly.
The email feature accesses the remote SMTP server that my ISP (web site hosting company) operates. This SMTP server requires authorisation (registered email address and password) for all outgoing mail but I can use any sender email address I like.
So problem is fixed for the moment anyway. Thanks for your advice.
|
|
|
|
|
I also found I had to use the construct
SmtpMail.SmtpServer.Insert(0, "mail.MyISP.com")
and not
SmtpMail.SmtpServer = "mail.MyISP.com"
to get the Win 2003 box to work properly.
|
|
|
|
|
Plz how can u open a vs2005 project in vs2008 without converting?
when u convert, does it mean ur project is now .Net framework 3.5?
i have an application in .net 2.0 with vs2005 and i just got vs2008 and have installed and want to use it but want my existing projects to remain .Net 2.o
Plz help
phatkin
|
|
|
|
|
prubyholl wrote: Plz how can u open a vs2005 project in vs2008 without converting?
AFAIK, you can't. There is no option to do so.
prubyholl wrote: when u convert, does it mean ur project is now .Net framework 3.5?
No. It means the solution files are converted to VS2008 format. The code, nor the dependancy on which framework it's using, is not changed at all.
<blockquote class="FQ"><div class="FQA">prubyholl wrote:</div>i have an application in .net 2.0 with vs2005 and i just got vs2008 and have installed and want to use it but want my existing projects to remain .Net 2.o</blockquote>
Then don't change it. The projects will still be using .NET 2.0 when you recompile them.
BTW, did you even TRY this to see what happens?? It's easy. Make a backup copy of your project folder and open the thing in 2008. Trial and error, and the ability to do research is the life blood of any developer worth his paycheck.
|
|
|
|
|
|
Hi,
Is it possbile to disable the topMost property on a complete vb.net program (.exe) or somehow bypass it... The software is started maximized and its topMost property is set to True so I cannot see any other forms while I run this program...
Thank you!
|
|
|
|
|
You gotta love idiot "developers".
There is no way to change it "application wide", but you can do it window-by-window, as they come up. You have to use the Win32 API functions directly to search for the titlebar text to get the window handle, then you can use that handle with other Win32 Window function calls to modify each window. I think you're looking for FindWindow[^] and SetWindowPos[^] functions at the least. You could be forced to use more of them in that category.
You may also just be wasting your time too. There's no guarantee that what you're doing will work at all, let alone 100% of the time.
|
|
|
|
|
Hi,
Dave is right. If it does not work (the app may refuse to resize, all depends on the
code), you should consider hooking up a second monitor (you can set up a dual-monitor
system such that maximize only fills one monitor).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I just want to know the process how to communicate with different types of hardwares (like telephone,electronic equipments,epbex,etc) through coding and how to get output from them.
Please let me know about any link , topic,books.
I deadly looking for any information regarding this.
Thanks in advance.
amolk
|
|
|
|
|
aamn1 wrote: I just want to know the process how to communicate with different types of hardwares (like telephone,electronic equipments,epbex,etc) through coding and how to get output from them.
This is determined completely by the hardware and the interface's exposed by them and the interfaces they connect to on your computer. There is no one link, or even a dozen links, that's going to explain every possible situation. Your best source of information on this is going to be the documentation for each device. What you do to communicate with these devices must be handled on a case-bny-case basis. There is no one way to talk to everything.
|
|
|
|
|
--------------------------------------------------------------------------------
I am upgrading my VB app from VB6 to VB.Net
here is the code complaining the error ( warning)
i am new to VB and how to resolve the problem?
oTask = goPackage.Tasks.New(gsDTSExecuteSQLTask) givs the problem
code :
Public Sub Task_Sub1(ByVal goPackage As Object)
Dim oTask As DTS.Task
Dim oLookup As DTS.Lookup
Dim oCustomTask1 As DTS.ExecuteSQLTask2
'UPGRADE_WARNING: Couldn't resolve default property of object goPackage.Tasks. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
oTask = goPackage.Tasks.New(gsDTSExecuteSQLTask)
oTask.Name = gsCreateTable & sTalDbtbl & gsTask
oCustomTask1 = oTask.CustomTask
|
|
|
|
|
If you click on that link (if you have the MSDN Library installed) it will tell you that before you run the upgrade process, you should go through your VB6 code to determinewhat statements are using the default properties of object, such as the Text property of a TextBox, and modify the code to explicitly specify the property instead of relying on the compile to know what the default property is.
The warning is saying that the upgrade wizard cannot determine what the default property is on some object in that statement. You have to modify the code to explicitly specify the default property of all the objects involved.
|
|
|
|
|
Hi all,
I have a data byte array which further I will convert it as PDF and print it.
Can anyone help me in this regards.
Is there any chance to print directly from byte array without converting into PDF.
Thanks in advance
Senthil
|
|
|
|
|
Senthil_GeoEdge wrote: I have a data byte array which further I will convert it as PDF and print it.
Can anyone help me in this regards.
Help with what?? What is this data??
Senthil_GeoEdge wrote: Is there any chance to print directly from byte array without converting into PDF.
Are you asking how to print a bunch of numbers on a page??
|
|
|
|
|
Hi,
Thanks for reply.
In detail,
I have designed a .rdl report using SQL Report Services 2005 in a server.
I have vb.net program in my client machine to access that report.
After rendering that report in client, I recieve data in byte() format.
I further use file stream to write that as a PDF.
Now, I want to print that to a particular printer.
Here is the code.
=========Code Starts
Dim results As Byte()
results = objReportingService.Render(m_sReportPath, sOutputFormat, HistoryId, DeviceInfo, LoadParams(), RSCredentials, ShowHideToggle, Encoding, MimeType, RSParamsUsed, RSWarnings, StreamIds)
Dim fs As System.IO.FileStream
fs = System.IO.File.OpenWrite(m_sFilePath)
fs.Write(results, 0, results.Length)
fs.Close()
=========Code Ends
Now the question again.
I want to print that PDF file OR Is there any chance to print directly from byte array without converting into PDF?
I hope its clear.
Thanks
Senthil
|
|
|
|
|
In my application having a problem to load, datgridview which as 2 column textbox,and combobox .on load event table values as to be shown in datagrid view using above two controls,combobox should have drop down properity and it should accept the changes on run time (not in wizard by using code)
Franics K Antony
|
|
|
|
|
I'd like to help, but I can't make heads or tails of your problem description.
You have a DataGridView and, I think, you want to show 2 columns of data from a database, one is a TextBox column, and the other in a ComboBox column??
|
|
|
|
|
I have program that generates a report. I'm trying to output the report as a pdf file. I can get it to save to the computer in pdf format however the document only shows half the form as the other half is cut off. I've been trying to change the layout and page types without success. Anyone have any ideas how to get the report to output as either one piece or on 2 pages? Here is my code for the outputting part.
Public Sub SavePDFReport()<br />
' gives user ability to output copy of report as PDF and choose a location to save it to<br />
MsgBox("Save file in PDF format by selecting CutePDF as printer.", MsgBoxStyle.OkOnly)<br />
Dim pd As New PrintDialog<br />
<br />
pd.ShowDialog()<br />
<br />
PrintPDFForm.PrinterSettings.PrinterName = "CutePDF Writer"<br />
PrintPDFForm.PrintAction = Printing.PrintAction.PrintToPreview<br />
PrintPDFForm.Print()<br />
<br />
<br />
<br />
End Sub
|
|
|
|
|
If you have a library to generate PDFs, your best bet is to create a screenshot of your app and turn the bitmap into a PDF.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Set FormBorderStyle to "none".
|
|
|
|
|