Status code 301 “moved permanently” in ASP.Net

Response.StatusCode = 301 Response.Redirect("http:////www.NewLocation.com") ''' doesn’t result in a status code of 301, so do it this way: ```C# Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http:////www.NewLocation.com"); Response.End(); thanks to: http://www.vikramlakhotia.com/Search_Engine_Web_World_and_301_redirect.aspx In ASP.Net 4 you can use Response.RedirectPermanent() In ASP the code would be: <%@ Language=VBScript %> <% Response.Clear Response.Status=”301 Moved Permanently” Response.AddHeader “Location”,”http://www.address\_to\_redirect\_to/” %>

March 21, 2012 · 1 min

The weirdest IE6 CSS bug – The multiple class bug

As described here: http://paulirish.com/2008/the-two-css-selector-bugs-in-ie6/ if you write #tooltip.red { background: white; color: red; } #tooltip.yellow { background: black; color: red; } the second rule will be ignored

March 13, 2012 · 1 min

naming conventions for custom stored procedures to be used in netTiers

Quoting from http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2008_03_01_archive.html “If you create your own procs, prefix those procs to something that you won’t confuse with any other library’s procs, such as ‘cust’ for custom. Of cource, IncludeCustoms is set to true and CustomProcedureStartsWith should be set to ‘cust_{0}_’ so that a table name of Profile should have a custom proc of cust_Profile_SelectAll.” if you set CustomProcedureStartsWith to just ‘cust_’ as we have done in the past, a method is created for each stored procedure for each table, whereas using ‘cust_{0}_’ only creates one method for each stored procedure – that method is linked to the table its name is based on. Far more sensible.

February 23, 2012 · 1 min

Calling LoadLibraryEx on ISAPI filter “C:WindowsMicrosoft.NETFrameworkv4.0.30319spnet_filter.dll” failed

If your website produces this error, Rick Strahl has the answer: http://www.west-wind.com/weblog/posts/2011/Apr/04/Error-on-64-Bit-Install-of-IIS-LoadLibraryEx-failed-on-aspnetfilterdll

February 3, 2012 · 1 min

IIS Permissions and the IIS_IUSR role

some web applications need access to the “temporary asp.net files” folder. The IIS_IUSR role already has read/write access to it but sometimes (i.e. the ePortfolio system) it needs to create a folder and can’t do that, even when the AppPoolIdentity account is a member of the IIS_IUSR role. In that case I just created the folder and it was fine… There could be a further problem when the AppPoolIdentity is a domain account: http://www.yusufozturk.info/iis7/asp-net-write-access-error-on-iis7-5.html

January 24, 2012 · 1 min

Enabling WCF web services in IIS7

would never have figured this one out: http://stackoverflow.com/questions/3188618/enabling-net-tcp

January 20, 2012 · 1 min

Referencing assemblies in the GAC in Visual Studio

Use this Visual Studio add in http://visualstudiogallery.msdn.microsoft.com/36a6eb45-a7b1-47c3-9e85-09f0aef6e879/

October 21, 2011 · 1 min

Beware of entity tracking

Entity tracking is clever and manages to keep a cache of recently used entities (and lists of entities) and, if it doesn’t see a change to an entity, it will return the cached version without going to the database – that’s what caching is after all. The problem is that ALL changes to the database MUST be made by the same project using .netTiers methods. If you’re developing an application and change data directly in the database then .netTiers won’t spot that. Pretty obvious really but do remember whether you have enableEntityTracking="true" or enableEntityTracking="false" in the SqlNetTiersProvider bit of your web.config

August 16, 2011 · 1 min

useStoredProcedure=true but still runs SELECT statements

.netTiers can be configured to only use stored procedures, which is a great way to reduce the possibility of the database being attacked as the user account can be given access to only execute stored procedures and not have any direct access to the tables. To do this, just set useStoredProcedure=true in the netTiers <providers> section of the web.config If you do this, some pages (methods) will still need SELECT access to tables. By default, netTiers creates entitygridviews that use paging and so use the get_paged method, which calls the myTable_GetPaged stored procedure. This stored procedure builds a couple of SQL strings (SELECT statements) that are executed, which means that the user account needs to have access to run SELECT statements. To give SELECT access to all tables in the database, you can add the user account to the db_datareader role.

June 3, 2011 · 1 min

Getting the ID of a newly inserted record

if you’re using a <data:MultiFormView ID="FormView1"> bound to a <data:MyTableDataSource> then it isn’t obvious how to get the ID of a record that you’ve just inserted e.g. you might want to redirect back to the same form but with the new ID in the querystring to further edit the form or related information. This is all you need to do: protected void FormView1_ItemInserted(Object sender, EventArgs e) { int Myid = BMyTableDataSource.EntityId.Myid; }

April 18, 2011 · 1 min