February 2010 Entries
This is the code I use to send an email from an asp.net page: Dim message As New MailMessage() message.IsBodyHtml = False message.From = New MailAddress("foo@foo.com") message.To.Add(New MailAddress("foo@foo.com")) message.Subject = ("Response from form") message.Body = ("Email message here") Dim client As New SmtpClient() client.Host = "email.foo.foo" client.Send(message)...
I am starting work on some asp.net vb pages to consume and work with web services. Part 1 was to create a web form that posts xml that a dba can paste into a textbox on an aspx page. Here is the code; Imports System.Net Imports System.IO Partial Class _Default Inherits System.Web.UI.Page Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click Dim Data As String Dim WebRequest As WebRequest Dim RequestStream As Stream Dim StreamWriter As StreamWriter Dim...
Here is my web.config used to login protect a folder called administration; <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <customErrors mode="Off"> </customErrors> <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999"> <credentials passwordFormat="MD5"> <user name="admin" password="21232F297A57A5A74... /> </credentials> </forms> </authentication>...
This handy bit of sql code returns the last identity value inserted into an identity column in the current scope and sets its value to the parameter @ID SET @ID = SCOPE_IDENTITY() I found this a very useful thing to get to grips with and start using in my code. For further information on scope identity hit this msdn link
Exposing the property: Public Property stringproperty() As String Get Return _stringproperty End Get Set(ByVal value As String) _stringproperty = String.empty End Set End Property Accessing the property from a content page: You will need to add this line to your .aspx page in order to be able to access the property you just exposed @ MasterType VirtualPath ="~/yourmasterpagename.master" %> You will then be able to access the property programatically from your content page like this; Master.stringproperty...