This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Hugo Bonacci | |
* http://hugoware.net | |
* | |
* UserControls in Web Application projects do not appear unless | |
* you use the Register tag at the top of the page or add them and | |
* their virtual path to the web.config file. | |
* | |
* This code allows you to add the namespace of your UserControls | |
* to the web.config file and it will automatically scan for any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Security.Principal; | |
using System.Text.RegularExpressions; | |
namespace Security { | |
/// <summary> | |
/// Allows you to execute code with an alternate set of credentials | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
namespace MvcWebControls { | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
//Requires ImpersonationContext that can be found | |
//at http://gist.github.com/357819 | |
using Hugoware.Security; | |
namespace Hugoware { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Series of extension methods to make working with | |
* enumerated types and bitwise operations easier. | |
* | |
* //create the typical object | |
* RegexOptions options = RegexOptions.None; | |
* | |
* //Assign a value | |
* options = options.Include(RegexOptions.IgnoreCase); //IgnoreCase | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Attempts to identify an anonymous value using the type name and a variety of common traits | |
/// (Unlikely this is the best way to determine) | |
/// </summary> | |
public static bool IsAnonymousType(object value) { | |
//make sure this has a value | |
if (value == null) { return false; } | |
//check if this is anonymous type using the name and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//More information about this code | |
//http://somewebguy.wordpress.com/2010/07/15/almost-sorta-real-dynamic-in-net/ | |
// | |
// Usage: | |
// | |
// var item = new Dynamic(); | |
// | |
// Assign single values | |
// item.value = "something"; | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quickly switch to a different culture to perform work without | |
// switching the entire thread | |
// Usage: | |
// Console.WriteLine("Starts in English : {0}", DateTime.Now); | |
// | |
// Culture.As(Culture.Type.German, () => { | |
// Console.WriteLine("Now in German : {0}", DateTime.Now); | |
// }); | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MimeTypeLocator { | |
#region Available Types | |
private static Dictionary<string, string> _MimeTypes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { | |
{ "323", "text/h323" }, | |
{ "acx", "application/internet-property-stream" }, | |
{ "ai", "application/postscript" }, | |
{ "aif", "audio/x-aiff" }, | |
{ "aifc", "audio/x-aiff" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'requests a name and attaches to that process | |
Public Sub AttachToNamedProcess() | |
Dim process As String = InputBox("What process name", "Process Name", "w3wp.exe") | |
'make sure something was provided | |
If process Is Nothing Then process = "" | |
process = process.Trim() | |
If String.IsNullOrEmpty(process) Then Return | |
_AttachToProcess(process, False) | |
End Sub |
OlderNewer