|
Ok, there is no loop in the code in the Basic programing technical sense. On the other hand why, after doing the End Sub of the Protected Sub Button1_click, does it go back to the first statement of the Protected Sub Button1_click procedure and proceed to do it all over again?
Here is a copy of the entire code behind page Page/History.aspx.vb. When I step through, statement by statement, it jumps over the Catch statements and does Finally and its statements and then End Try and then End Sub and then jumps to Protected Sub Button1_click, does the Dims and starts the Send Mail all over again.
I use ASP 3.5, Visual Web Developer Express 2008. The four Dims are there so I could be sure I picked up the four variables from the Display page. Once I know things are working correctly,
Much thanks for your help.
Imports System.Web.UI
Imports System
Imports System.Net
Imports System.Net.Mail
Imports System.Web.TraceContext
Partial Class Feedback
Inherits Page
Protected Sub Button1_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SenderName As String = TxtName.Text
Dim SendersEmail As String = TxtEmail.Text
Dim Subject As String = TextSubject.Text
Dim Message As String = TxtMessage.Text
SendMail(SenderName, SendersEmail, Subject, Message)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Sub SendMail(ByVal SenderName As String, ByVal SendersEmail As String, ByVal Subject As String, ByVal Message As String)
Dim NetMail As New MailMessage
Dim MailClient As New SmtpClient
Dim ThisHost As String = "MAILSERVER"
Dim ThisPort As Integer = 25
Dim TheseCredentials As New NetworkCredential("USERNAME", "PASSWORD")
' Dim ThisSender As String = "SENDERNAME <RECIPIENTMAIL>"
Dim ThisSender As String = SenderName
' Dim ThisRecipient As String = "RECIPEINT MAIL <RECIPIENTMAIL>"
Dim ThisRecipient As String = "mhh112@hotmail.com"
' Dim ThisSilentRecipient As String = String.Empty
Try
' NetMail.From = New MailAddress(ThisRecipient)
NetMail.ReplyTo = New MailAddress(ThisRecipient)
NetMail.To.Add(New MailAddress(ThisRecipient))
' If Not ThisSilentRecipient = "" Then
' NetMail.Bcc.Add(New MailAddress(ThisSilentRecipient))
' End If
NetMail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
NetMail.IsBodyHtml = False
NetMail.Priority = MailPriority.Normal
' NetMail.Subject = "Test Subject" & DateTime.Now.ToLongTimeString()
NetMail.Subject = Subject & " " & DateTime.Now.ToLongTimeString()
' NetMail.Body = "Test Body " & DateTime.Now.ToLongTimeString()
NetMail.Body = DateTime.Now.ToLongTimeString() & " " & Message
MailClient.DeliveryMethod = SmtpDeliveryMethod.Network
' MailClient.Host = ThisHost
MailClient.Port = ThisPort
MailClient.UseDefaultCredentials = False
MailClient.Credentials = TheseCredentials
MailClient.Send(NetMail)
Catch EXC As Exception
Trace.Warn(EXC.Message)
Finally
NetMail.Dispose()
NetMail = Nothing
MailClient = Nothing
End Try
End Sub
Protected Sub TxtName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
End Class
|
|
|
|
|
You don't, by any chance, have an onclick="" defined for the button in the aspx page, as well as the handles statement in the code behind?
|
|
|
|
|
Yes, I have both statements. I have experimented taking one out and then the other but removing one or the other gets me "do you want to continue or do you want to see what the error is.
Taking one or the other out doesn't seem to get me down to the <asp:panel id="panelMailSent" ....="" xmlns:asp="#unknown"> statement. I've added a text box to see if I am really back from the <asp:button....> statement. I can type in the text box and when I hit the return, I'm back doing the Button1_click procedure. And that is with the handles statement saying quite obviously that the procedure is tor the Button1.Click procedure.
I had this working with system.web.mail but constantly got messages that it was an old way to do things. So I changed to the System.net.mail namespace and can't make it work. Like all programming errors, when I finally get it to work, it will be a minor change.
By the way. I appreciate your help. Eventually, it will work. Everyone but me can send mail with System.net.mail.
One other thing. I am sending the email comment to hotmail. Microsoft says, well here is a copy of the message:
Reporting-MTA: dns;hkram
Received-From-MTA: dns;hkram
Arrival-Date: Wed, 17 Dec 2008 15:18:44 -0500
Final-Recipient: rfc822;mhh112@hotmail.com
Action: failed
Status: 5.0.0
Diagnostic-Code: smtp;550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated SMTP e-mail to an Internet mail server. http://www.spamhaus.org maintains lists of dynamic and residential IP addresses. If you are not an email/network admin please contact your E-mail/Internet Service Provider for help. Email/network admins, please visit http://postmaster.live.com for email delivery information and support
What is an ordinary Tom,Dick or Jane supposed to do with a message like that? Why can't the message say it's getting certain fields filled out so the server looks like a dynamic server. If you change a field to this value, we will accept your message. Why is that so difficult?
Again, thank you for your help. It's nice to have someone to complain to. Although you are not the proper person to complain to.
Mark H.
|
|
|
|
|
Hi,
I am facing a strange problem theses days with my websites.
Like, the database is currently saved in English Language ant display by the UI is as 'Ȅ૪eC,eCnC૪ilpi૪ʨ9 ૪pe9nC૪hSCpiC ૪K9e૪o9S૪1C૪i9૪'
Even now if some one saves the data in DB, the Junk Chars will be saved.
Now i changed the web.config and add <glbalization> tag, but the error is not resolved.
I got error when i edited the web.config and added a globalization tag:
'Parser Error Message: Recursive fallback not allowed for character \u003F'
Is this a problem with DB charset or ASP.NET settings. I am using .net 2.0 and SQL 2005
Also, i am not specifying any charset in Meta Tag.
Please help.
Aman Bhullar
modified on Sunday, December 14, 2008 4:30 AM
|
|
|
|
|
I am also getting this problem, did anyone get any solution for this? My ASP.NET website works fine on my local machine, but I get the same error when uploading to the host. The site was working fine and then I updated some text on ONE of the pages, now I get this error on ALL the pages. My site is in English and hosted in the UK so I don't think its a language problem for me.
Any suggestions appreciated!
|
|
|
|
|
hi,
The problem is not in your code. The problem is with the webserver. I don't know what is the problem, but i had a long fight with my host. According to them they have fixed it, but it is there occasionally.
The best way is to report the host regarding this at time when same is displayed on screen, only then they can diagnose. But they will never tell nature of issue.
|
|
|
|
|
Hi, You are right - when I reported it to the host they did fix it and just said it was a 'server issue'. So although I'm not much wiser, at least its working! Thanks for your reply.
|
|
|
|
|
Hi Friends,
I tried to insert Chinese into a html file in Apache-Tomcat server, and whenever i refresh it and check this page online through URL, it doesn't show Chinese but some unrecognized characters.
Can anyone tell me what the problems might be? Server side problem or my setting issue? Many Thanks...
|
|
|
|
|
What format did you save your HTML file in - it'll need to be saved in a Unicode format.
|
|
|
|
|
Hi
I am not sure if this is the right place to post my question.
I have a web application. When i run the application data provided by the user should go and settle in their corresponding outlook calander.
I got example from following link
http://www.codeproject.com/KB/office/OutlookDemo.aspx
but am not able to download the source code.
Could somebody provide me code for this.
Thanks in advance
naina
|
|
|
|
|
nainakarri wrote: I got example from following link
http://www.codeproject.com/KB/office/OutlookDemo.aspx
but am not able to download the source code.
Why ? If you are a registered user then you should able to download that.
What was the problem to downlad that ?
|
|
|
|
|
I donloaded it, but unable to view the code. Not able to open in visual studio. Its giving error stating source not found.
Am not even able to run it.
I have downloaded into my laptop and opened the solution.
Thanks
naina
|
|
|
|
|
What happens when you try to download the source..?
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
When i down load the source code, a zip file is downloaded.
then when i tried to open the .cs file, i could see no data
when i open .js file, its giving 'uable to open ......file source: microsoft jscript error'
when i tried to open the solution ,
i am getting error,"the project file or web has been moved or renamed or is not in your computer"
thanks
naina
|
|
|
|
|
I checked, everything looks fine.
I am surprised to read it as I remember you saying that the demo is working perfectly fine.
Hope you are not facing any problem.
|
|
|
|
|
Hi folks,
this is my first message and blablablabla..., let's talk about serious stuff.
In my aspx website I'd like to insert a gallery of images using lightbox 2, http://www.lokeshdhakar.com/projects/lightbox2; at the same time I'm also using UrlRewriting. When i have UrlRewriting turned on if I try to view the images lightbox doesn't run, just I get a redirect directly to the image; to the other hand, when UrlRewriting is turned off lightbox runs very well.
Can anyone help me?
Thanks!
|
|
|
|
|
I've been trying to create a group of rules in .htaccess that will deny bots access to specific groups of pages in my site. Specifically, my site is a Wiki (running MediaWiki), and I would like to prevent bots from accessing any pages in the "User", "Talk" or "Special" namespaces, while allowing them to spider other pages on the site.
Below is my attempt... but it's not working. The basic approach I'm trying to use is this:
1. set an environment variable that identifies if the REQUEST_URI's that I want to exclude
2. set an environment variable that detects if the user agent is a bot
3. If both of the above environment variables are set, deny the page.
Can anyone give me a tip as to why the code below is NOT doing what I describe above?
RewriteEngine on
### Identify non-bot pages with environment variable
RewriteCond %{REQUEST_URI} ^/reference/index.php?title=User:.* [OR]
RewriteCond %{REQUEST_URI} ^/reference/index.php?title=Talk:.* [OR]
RewriteCond %{REQUEST_URI} ^/reference/index.php?title=Special:.*
RewriteRule ^.* - [E=PAGE_NO_BOT:1]
### Identify bot user agents with environment variable
RewriteCond %{HTTP_USER_AGENT} ^.*Googlebot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*robot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Slurp.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Scooter.*
RewriteRule ^.* - [E=CLIENT_IS_BOT:1]
### If it is a bot AND it is looking at a non-bot page, deny
RewriteCond %{ENV:PAGE_NO_BOT} ^1$
RewriteCond %{ENV:CLIENT_IS_BOT} ^1$
RewriteRule ^.* - [F,L]
|
|
|
|
|
Hello Everyone
I Have two text boxes having a label of Emp Name and Emp Sal and then click on submit button that values will added in a gridview and from gridview it will inserted into databse. I am using asp.net 2.0 and sql serevr 2005
Thanks in advance
Saurabh Agarawl
modified on Friday, December 12, 2008 12:48 AM
|
|
|
|
|
|
Hi
Thanks for sending a link..
but i dont wont this, there are two textboxes and button, user will enter the values in textbox, and then after clicking on add button it will enter into griview and from gridview it enter into database.
Thanks in advance
Saurabh agarwal
|
|
|
|
|
HI
I am using iTextSharp - table control to create tables.
I was able to add 2 inner tables to an outer table by:
m_OuterTable = new Table(columns, rows)
{
Width = 100,
Cellpadding = 2,
BorderWidth =0
};
m_InnerTable1 = new Table(columns, rows)
{
Width = 80,
Cellpadding = 2
};
m_InnerTable2 = new Table(columns, rows)
{
Width = 80,
Cellpadding = 2
};
m_Outertable.InsertTable(m_InnerTable1);
m_Outertable.InsertTable(m_InnerTable2);
document.Add(m_OuterTable);
When I do the above the two inner tables touch each other. I would like to add a few space between them so that they look like two different tables, rather than 4 columns as it looks now.
Thanks in advance
BV
|
|
|
|
|
I'm sure there are plenty of people who can tell by looking at it...but what language am I looking at?
|
|
|
|
|
Hi,
I am using ITextSharp tables, in C#.
Thanks in advance
|
|
|
|
|
I would like to know how to capture the current position of the cursor within a textbox, and then if necessary how to place within the text area to change the text insertion point.
Thanks,
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
Hi,
Just out of curiosity, does it matter in what order the javascript, stylesheets and metatags appear on the web page?
Is this acceptable:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="Includes/Stylesheets/mystyles1.css" />
<meta name="robots" content="index,follow" />
<link rel="stylesheet" type="text/css" href="Includes/Stylesheets/mystyles2.css" />
The reason why I aqsk is because I have a master page which has styles needed across all web pages, but some pages require additional styles, and it seems as if .NET appends to the last one instead of grouping all the meta tags or stylesheets.
Brendan
|
|
|
|