Geeks With Blogs
Phil Sando February 2010 Entries
Send email from an vb page
This is the code I use to send an email from an page: Dim message As New MailMessage() message.IsBodyHtml = False message.From = New MailAddress("") message.To.Add(New MailAddress("")) message.Subject = ("Response from form") message.Body = ("Email message here") Dim client As New SmtpClient() client.Host = "" client.Send(message) ......

Posted On Saturday, February 27, 2010 3:48 PM

Simple web form that posts XML to a web service
I am starting work on some 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 ......

Posted On Saturday, February 27, 2010 3:22 PM

Web.config file to password protect a directory in any web site
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> ......

Posted On Saturday, February 27, 2010 2:52 PM

Scope Identity (short but sweet)

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


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


Posted On Wednesday, February 10, 2010 11:14 AM

Adding properties to an masterpage
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 ......

Posted On Wednesday, February 10, 2010 10:46 AM

Copyright © PhilSando | Powered by: