Adding app_offline.htm to the root of your .net application automatically shuts it down. Very nice for putting up a quick maintenance page.
All the junk I have in my head
Adding app_offline.htm to the root of your .net application automatically shuts it down. Very nice for putting up a quick maintenance page.
Regex.Replace(filePath, ".txt", ".zip", RegexOptions.IgnoreCase);
All types and type members have an accessibility level, which controls whether they can be used from other code in your assembly or other assemblies. You can use the following access modifiers to specify the accessibility of a type or member when you declare it:
public
The type or member can be accessed by any other code in the same assembly or another assembly that references it.
private
The type or member can be accessed only by code in the same class or struct.
protected
The type or member can be accessed only by code in the same class or struct, or in a class that is derived from that class.
internal
The type or member can be accessed by any code in the same assembly, but not from another assembly.
protected internal
The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.
http://msdn.microsoft.com/en-us/library/ms173121.aspx
This code project helped me out a lot.
http://www.codeproject.com/Articles/19639/Implementing-IHierarchy-Support-Into-Your-Custom-C
The following removes all commas from the end of a string.
while (str.ToString().EndsWith(",")) { str = str.Remove(str.Length - 1, 1); }
I needed to redirect a HTTP website to HTTPS. I thought it was part of IIS, and I think it was at some point. Maybe in IIS 7.0.
But here is the code to redirect to HTTPS. I grabbed it from here http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/.
You will also need to install the URL Rewrite module located here: http://www.iis.net/download/urlrewrite.
<rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /> </rule>