Here is a great article that explains how to use TVP’s via .Net and a stored procedure
If you need to force the user to a particular page, regardless of what the ReturnURL is stating, then use the following code in your Page_Load
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack && !string.IsNullOrEmpty(Request.QueryString["ReturnURL"]))
//Do this to remove any URL info the user may be trying to get to
If you’ve locked down access to your website but what your login page to pick up a stylesheet from a sub folder then you need to a add a location tag to your web.config to grant access
<location path="Styles"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location> <location path="Images"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
To configure the strength of the password used by the CreateUserWizard control it needs to be set in the membership section of your web.config
The above example sets it to 7 alphanumeric characters.
Using the default style for the register and password recovery controls, the register expects a user name and email address. The passowrd recovery template asks for your email address, but what it actually looks up in the background is based on the user name and will therefore never find a match for the email address entered. A quick way round this is to change the default text to say User name instead of Email Address!
When the CreatedUser event is fired and the LoginCreatedUser is set to true, the new user is only logged in once the event is completed! To get the new user information use the following code…
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
TextBox serialNumberTextBox =
SerialNumber serial = new SerialNumber(serialNumberTextBox.Text);
serial.UserId = Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey.ToString();
serial.DateRegistered = DateTime.Now;
I can’t find anyway of using the ErrorMessage that is part of the CreateUserWizard. I can FindControl OK and set the values, but when it is rendered to the page its blank. Had to resort to adding my own literal to the page so that I can see my errors.
To configure an existing site to use ASP.Net Membership, but storing the data in the site database rather than creating an MDF in the APP_Data folder.
Run the utility c:\windows\microsoft.net\framework\v2.0.50727\aspnet_regsql
Follow the wizard to connect to the relevant server/database, this will need to be repeated for both test and production.
In the <system.web> section of the web.config ensure that an entry as below is included…
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
In the <connectionStrings> section add the appropriate connection string with a key of “SecurityConenction”
While editing the site within VS2005, from the WebSite menu selecti ASP.Net Configuration. This will open a web page that allows you to create users and rules for the application. Rules that are defined are stored in the Web.Config, so do this for the development site only, as you won’t have access to the live config file. Any folders with restricted access will also have a web.config file created in them, these will need to be promoted to live.
To release to production, change your security connection to point to the production database, set up the relevant users, but not the rules. Then when promoting code to production manually update the root config with the required authorisation, membership and connection strings, that can be taken from the development config file.
- June 2016
- October 2013
- January 2013
- June 2012
- May 2012
- March 2012
- February 2012
- January 2012
- May 2011
- February 2011
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- November 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008