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
OpenPOP.POP3.POPClient client = new POPClient("pop.yourserver.co.uk", 110, "[email protected]", "password_goes_here", AuthenticationMethod.USERPASS); | |
if (client.Connected) { | |
int msgCount = client.GetMessageCount(); | |
/* Cycle through messages */ | |
for (int x = 0; x < msgCount; x++) | |
{ | |
OpenPOP.MIMEParser.Message msg = client.GetMessage(x, false); | |
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
protected void Application_BeginRequest(object sender, EventArgs e) | |
{ | |
//If upper case letters are found in the URL, redirect to lower case URL. | |
if (Regex.IsMatch(HttpContext.Current.Request.RawUrl.ToString(), @"[A-Z]") == true) | |
{ | |
if (Request.HttpMethod == "GET" && !(Request.RawUrl.Contains(".axd"))) | |
{ | |
string LowercaseURL = HttpContext.Current.Request.RawUrl.ToString().ToLower(); | |
Response.Clear(); | |
Response.Status = "301 Moved Permanently"; |
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
//newParentFolderId = the parentId you want to move the document to | |
//documentObject = the document you're moving to its new location. | |
documentObject.Move(newParentFolderId); | |
if (!autoFolder.EnableBatchProcessing) | |
{ | |
library.RefreshContent(); | |
documentObject.Publish(new User(0)); |
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> | |
/// Broadcasts the update to all connected clients. I've done this directly in the controller to | |
/// demonstrate server -> client pushing, rather than client -> client pushing. | |
/// </summary> | |
/// <param name="updateItem">The update item.</param> | |
internal static void BroadcastUpdate(Update updateItem) | |
{ | |
// Fetch the hub's context to broadcast | |
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<LiveUpdate.Hubs.LiveUpdateHub>(); |
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.Web; | |
using SignalR.Hubs; | |
namespace LiveUpdate.Hubs | |
{ | |
/// <summary> | |
/// Skeleton hub class used to establish connections. |
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
/// <reference path="jquery-1.7.2.js" /> | |
/// <reference path="jquery-ui-1.8.20.js" /> | |
/// <reference path="jquery.signalR-0.5.2.js" /> | |
$(function () { | |
// Establish a connection to the updateFeed hub | |
var hub = $.connection.updateFeed; | |
// Extend the object with our feedUpdated method held within the updateFeed hub | |
$.extend(hub, { |
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> | |
/// Gets the cell reference (A1, B2, etc) by object implementing ICell. | |
/// </summary> | |
/// <param name="cell">The cell.</param> | |
/// <returns>cell reference as string</returns> | |
private string GetCellReferenceByCell(ICell cell) | |
{ | |
CellReference cellRef = new CellReference(cell); | |
return cellRef.FormatAsString(); | |
} |
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 static void RegisterGlobalFilters(GlobalFilterCollection filters) | |
{ | |
filters.Add(new HandleErrorAttribute()); | |
} |
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 static void RegisterGlobalFilters(GlobalFilterCollection filters) | |
{ | |
filters.Add(new ElmahHandledErrorLoggerFilter()); | |
filters.Add(new HandleErrorAttribute()); | |
} |
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 ElmahHandledErrorLoggerFilter : IExceptionFilter | |
{ | |
public void OnException(ExceptionContext context) | |
{ | |
// Log only handled exceptions, because all other will be caught by ELMAH anyway. | |
if (context.ExceptionHandled) | |
ErrorSignal.FromCurrentContext().Raise(context.Exception); | |
} | |
} |
OlderNewer