by Jeremy Brown
11. May 2012 21:07
Follow the instructions in the link below for blocking specific IP addresses through IIS
http://blog.lowtek.com/2006/09/how-to-block-ip-address-on-windows.html
by Jeremy Brown
1. May 2012 20:41
You may have noticed in ASP.NET when you do a postback on the page it loses the URL rewriting so something like www.mysite.com/news-article-1 becomes www.mysites.com/news.aspx?id=1
I found a solution to this here http://stackoverflow.com/questions/5191612/asp-net-postbacks-creates-problem-in-url-rewriting
In the Master Page page load event place the following code:
form1.Action = Request.RawUrl;
form1 being the id of your form tag.
by Jeremy Brown
3. February 2012 01:43
Useful MIME types for Microsoft Office documents:
You upload a file to your CMS via your rich text box but you get a 404 error.
The solution to this is Internet Information Services (IIS)
Out of the box, IIS6 only accepts requests for known MIME types. Since Office 2007 was released after Windows Server 2003 and IIS6, IIS6 knows nothing about the new MIME types. So you need to manually add them:
Open Computer Management. (Right-click My Computer… Manage…)
Right-click Internet Information Services (IIS) Management… Properties…
Click MIME Types…
Click New… and add the following:
| .docx |
application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| .xlsx |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
| .pptx |
application/vnd.openxmlformats-officedocument.presentationml.presentation |
61bad2f2-7c3a-4945-9430-20a150e62a3b|0|.0
Tags:
Hosting
by Jeremy Brown
2. February 2012 22:10
Total database size script
SELECT
[SpaceUsed(KB)] = SUM(alloc.used_pages)*8
FROM sys.objects obj
JOIN sys.indexes idx on obj.object_id = idx.object_id
JOIN sys.partitions prt on obj.object_id = prt.object_id
JOIN sys.allocation_units alloc on alloc.container_id = prt.partition_id
WHERE
obj.type = 'U' AND idx.index_id IN (0, 1)
18c2ff33-0adb-449f-8039-fe08c2b2e8d4|0|.0
Tags:
by Jeremy Brown
24. November 2011 01:27
I had a problem with PrettyPhoto not working within an Update Panel. I found this solution which seems to do the trick:
http://forums.asp.net/p/1468161/3723242.aspx
<script type="text/javascript">
function pageLoad() {
$("a[rel^='prettyPhoto']").prettyPhoto();
}
</script>
by Jeremy Brown
10. October 2011 18:23
Just a method of doing a 301 redirect from non-www to www I came across rather than doing it through IIS
http://www.barrywise.com/2008/10/seo-canonical-urls-and-301-redirects-in-windows-iis-6-iis-7/
Try
Dim requestedDomain As String = HttpContext.Current.Request.Url.ToString().ToLower()
If InStr(requestedDomain, "http://thewebbureau.com") Then
requestedDomain = requestedDomain.Replace("http://thewebbureau.com", "http://www.thewebbureau.com")
Response.Clear()
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", requestedDomain)
Response.End()
End If
Catch ex As Exception
Response.Write("Error in Global.asax :" & ex.Message)
End Try
3ddb210a-cfdc-4a3a-8b6e-d014caf44f6b|1|5.0
Tags:
by Jeremy Brown
23. September 2011 00:43
Found this script which allows you to order by table size http://www.sqlservercurry.com/2011/02/sql-server-count-rows-in-tables-and-its.html
-- Count All Rows and Size of Table by SQLServerCurry.com
SELECT
TableName = obj.name,
TotalRows = prt.rows,
[SpaceUsed(KB)] = SUM(alloc.used_pages)*8
FROM sys.objects obj
JOIN sys.indexes idx on obj.object_id = idx.object_id
JOIN sys.partitions prt on obj.object_id = prt.object_id
JOIN sys.allocation_units alloc on alloc.container_id = prt.partition_id
WHERE
obj.type = 'U' AND idx.index_id IN (0, 1)
GROUP BY obj.name, prt.rows
ORDER BY [SpaceUsed(KB)] desc
935876c1-2b8f-45fc-a964-0d256b84ab48|1|5.0
Tags:
by Jeremy Brown
28. January 2011 02:06
In a class you need to declare a session slightly differently:
HttpContext.Current.Session("SessionName")
01ef7dcb-ea98-4e62-b761-0f06600a5f83|2|3.0
Tags:
VB.Net
by Jeremy Brown
26. January 2011 18:45
This error message will occur when there is an invalid email address in the App_Data\Newsletter.xml file. This XML file contains email addresses of people who have signed up for the Newsletter (via the Newsletter widget). When you save a post, all the people in that file are sent an email. If an invalid email address exists, it will throw this error message.
If you remove any invalid email addresses from this XML file you may need to restart the blog for your changes to be detected. To restart the blog, simply modify the web.config file (e.g. add a space).
9d33d1ae-f157-4f23-b8ef-873ab50b8d90|2|4.5
Tags:
BlogEngine
by Jeremy Brown
26. January 2011 02:17
SQL Server has a system stored procedure you can run called sp_who that will provide you with information on the current SQL Server userse and processes. This can be filtered to return processes that are not idle.
293469c1-65e5-476c-a8ed-4aa79f2f5353|1|5.0
Tags:
SQL Server