‘code template ‘Membership.GeneratePassword(lenghtOfPass, numOfNonAlphaNumChar) ‘code Dim nPassword As String = Membership.GeneratePassword(8, 3) ‘Generates random password like this: &M0Zs[@Y
Archive for August, 2012
SqlConnection from web config file in code behind
test.aspx.vb Imports System.Data.SqlClient ————————————- Dim connString As String connString = ConfigurationManager.ConnectionStrings(“MyConnectionString1″).ToString Dim conn As New SqlConnection(connString) web.config <connectionstrings> <add name=”MyConnectionString1″ connectionString=”Data Source=MY-SQL-SRV;Initial Catalog=Northwind; Persist Security Info=True; User ID=my_user;Password=my_pwd” providerName=”System.Data.SqlClient” /> </connectionstrings>
Close thickbox (popup) refresh parent page
Test.aspx <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> </head> <body> <form id=”form1″ runat=”server”> < %= Me.UpdMsg %> </form> </body> </html> Test.aspx.vb Protected UpdMsg As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)Handles Me.Load If Page.IsPostBack Then UpdMsg = “<a href=’#’ onClick=’parent.location.reload(1)’>Close!</a>” End If End Sub