Thursday, July 29, 2010

SSO with ASP.NET

http://www.codeproject.com/KB/aspnet/SingleSignon.aspx

Membership setup and configuration issue

To implement Membeship API to an ASP.NET application (Framework 2.0/3.0/3.5), create the Web site in VS 2005/2008 and then click on "Website=>ASP.NET Configuration" and start the process.

If using a remote DB then need to put some settings into the Web.config before starting this wizard:

1) Add a connection string in the web.config:





2) Next, change the authentication mode to Forms:


3) For Roles add this settings:



type="System.Web.Security.SqlRoleProvider"/>




4) Add Providers details under section




type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="MyAspnetDB"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="MyApplicationName"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />



Once all these settings are in place, fire up the ASP.NET configuration tool and it will work perfectly.

http://bytes.com/topic/asp-net/answers/594723-error-provider-management-could-not-establish-connection-database

http://forums.asp.net/p/978442/1364770.aspx

Tuesday, July 13, 2010

Error Logging Modules And Handlers

A very nice utility for logging errors like Yellow screen of death and others occuring on the website. Can disable errors through web.config directive and by redirecting user to this error page.

Only need to modify the web.config and create new Tables, SP's in the SQL database and setting for SMTP for sending out emails.

http://geekswithblogs.net/joycsharp/archive/2008/02/15/simple-c-delegate-sample.aspx

Thursday, July 8, 2010

Automate sending emails from command prompt or script

You might want to use BLAT (a public domain command line mailer) instead. I like it much better than mapisend. You can download it at-http://www.interlog.com/~tcharron/blat.html or blat.net

Wednesday, July 7, 2010

VSTS 2008 Database Edition issues fix

http://blogs.msdn.com/b/gertd/archive/2008/06/03/vsts-2008-database-edition-gdr-june-ctp.aspx?wa=wsignin1.0

Apply below fix from MS after applying VS 2008 SP1 and it removes the requirement for using a local SQL instance and works perfectly fine.

http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&displaylang=en

Thursday, July 1, 2010

Taking an ASP.NET Site Offline with a Message

This was another one that I was literally beside myself that I didn't know this one before. A fellow business partner of mine named James Sutton mentioned this one to me. This one's been around since ASP.NET 2.0 as well. If you have an ASP.NET web application site, and you place a text file named "app_offline.htm" in the root of the site, all requests to that website will redirect to that app_offline.htm file. Basically, if you need to take an entire ASP.NET site offline, you can place some nice message in that file. Then, any new requests to a URL, any URL, in that website will redirect to that file allowing you to do maintenance to the site, upgrades, or whatever. It is not really a redirect though. ASP.NET essentially shuts down the site, unloads it from the server, and stops processing any requests to that site. That is, until you delete the app_offline.htm file - then things will continue as normal and your ASP.NET site will load up and start serving requests again.

A super-cool side effect of this is that any files that are locked by the site, such as a database or other resources, are freed since the application domain has been unloaded from the server. This allows you to remove the locks from those files and replace them, without the need to do a full IISRESET, taking down other sites on the server. One thing to keep in mind with this file however, make sure you out enough content in it so it is larger than 512 bytes or IE will consider it a 404 and will display the 404 instead of the contents of your app_offline.htm file.

http://weblogs.asp.net/pleloup/archive/2008/09/22/taking-an-asp-net-site-offline-with-a-message.aspx