asp.net scripts (1 Viewer)

Register Today to see less ads! It's Free!

rockymtnhigh

Hardly Normal
Supporting Founder
Apr 14, 2006
30,193
917
Normal, IL
Does anyone have any (uncopyrighted) asp.net scripts you might be willing to share? I am moving my personal web presence to the University's server, and they support asp.net, but not cold fusion (making it impossible for me to use many of the CF scripts I have used for authentication and more importantly email form processing), and I am trying to hunt down a few scripts (again, most important is form processing) .
 
Register Today to see less ads! It's Free!

VinceT3

SatelliteGuys Pro
Jun 12, 2006
2,101
5
Rainsalot Florida
cold fusion is a bit more simple than .net, if you need help post questions.. but no scripts will work 100% for your needs.. what kind of form processing are you looking for.. send an email out based on form values?
 

rockymtnhigh

Hardly Normal
Supporting Founder
Apr 14, 2006
30,193
917
Normal, IL
cold fusion is a bit more simple than .net, if you need help post questions.. but no scripts will work 100% for your needs.. what kind of form processing are you looking for.. send an email out based on form values?

Yes, exactly that.

I know that CF is more simple; but I doubt I can convince the Dean's Office to purchase it.
 

rockymtnhigh

Hardly Normal
Supporting Founder
Apr 14, 2006
30,193
917
Normal, IL
CF isn't quite as popular as it once was.. gimme a few I should be able to whip something quick up for you..

Thanks much.

I always liked CF; and Ben Forta's CF Applications books are among the few computer books I could actually make sense out of! :)
 

VinceT3

SatelliteGuys Pro
Jun 12, 2006
2,101
5
Rainsalot Florida
This should work.. mind you I didn't test it.. but it's fairly simple so I don't expect issues with it :p

Code:
Dim msg as String = String.Empty
For Each key As String In Request.QueryString.Keys
    msg &= key & "=" & Request.QueryString[key]
Next
Dim smtp as System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()
smtp.Send("from@from.com", "to@to.com", "subject of email", msg)

You can change the QueryString to Form if you're using POST rather than GET, obviously change the from/to/subject
 

rockymtnhigh

Hardly Normal
Supporting Founder
Apr 14, 2006
30,193
917
Normal, IL
This should work.. mind you I didn't test it.. but it's fairly simple so I don't expect issues with it :p

Code:
Dim msg as String = String.Empty
For Each key As String In Request.QueryString.Keys
    msg &= key & "=" & Request.QueryString[key]
Next
Dim smtp as System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()
smtp.Send("from@from.com", "to@to.com", "subject of email", msg)

You can change the QueryString to Form if you're using POST rather than GET, obviously change the from/to/subject

Thanks, I will play with that when I get a chance later today.
 

rockymtnhigh

Hardly Normal
Supporting Founder
Apr 14, 2006
30,193
917
Normal, IL
Well, I'll be honest, in that Vince's code was a bit over my head; however, further digging online enabled me to actually implement a email processor that is working pretty smoothly. I integrated it into an existing dreamweaver site; and even set it up so that it cc's the message to the sender, uses a reply-to so that when I receive it, I can just hit reply.

I am pretty pleased; but still think I will end up at Borders and look at their Asp.net books; since the server is only running asp.net 1.1 I might be able to get some of the older books for cheap. We'll see.

BTW, the page I created is here.

The code I used follows:

Code:
< % @Import Namespace="System.Web.Mail" %>
< script language="vb" runat="server">

Sub btnSendFeedback_Click(sender as Object, e as EventArgs)

  'Create an instance of the MailMessage class
  Dim objMM as New MailMessage()

  'Set the properties - send the email to the person who filled out the
  'feedback form.
  objMM.To = "****************" 
 
  objMM.From = "**************"

  objMM.Headers.Add("Reply-to", txtEmail.text )

  'If you want to CC this email to someone else, uncomment the line below
  objMM.Cc = txtEmail.Text

  'If you want to BCC this email to someone else, uncomment the line below
  'objMM.Bcc = "someone@someaddress.com"

  'Send the email in text format
  objMM.BodyFormat = MailFormat.Text
  '(to send HTML format, change MailFormat.Text to MailFormat.Html)

  'Set the priority - options are High, Low, and Normal
  objMM.Priority = MailPriority.Normal

  'Set the subject
  objMM.Subject = "Web mail"

  'Set the body
  objMM.Body = "At " + DateTime.Now + " An Email was sent from Dr. Gizzi's webspace " & _
               "Below you will find the message " & _
               "sent by " & txtName.Text & "." & vbCrLf & vbCrLf & _
               "---------------------------------------" & vbCrLf & vbCrLf & _
               txtMessage.Text & vbCrLf & vbCrLf &  "Email address: " + txtEmail.Text  
			   

  
  'Specify to use the default Smtp Server
  SmtpMail.SmtpServer = "*************"
  
  'Now, to send the message, use the Send method of the SmtpMail class
  SmtpMail.Send(objMM)


  panelSendEmail.Visible = false
  panelMailSent.Visible = True
End Sub

< /script>

And then I just used asp panels inside the webpage.

My next goal is to figure out if I can have an attachment sent as well.
 
Register Today to see less ads! It's Free!
Register Today to see less ads! It's Free!

Users who are viewing this thread

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

Latest posts

Top