Skip to content

Instantly share code, notes, and snippets.

@dingjing
dingjing / table-dnd.js
Created February 19, 2014 19:07
Insert js source in prologue
<script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="../jquery.tablednd_0_5.js" type="text/javascript"></script>
<a id="StartOfPageContent"></a>
@dingjing
dingjing / elmah_ldap_config.xml
Created February 12, 2014 03:33
Config LDAP for ELMAH.
<add key="ElmahRole" value="IT Developers"/>
<add key="ElmahAuthServer" value="ldap.mycompany.com"/>
@dingjing
dingjing / add_securElmah.xml
Created February 12, 2014 03:25
Register SecurElmah in web.config.
<add name="ErrorAuth" type="SecurElmah.AuthModule, SecurElmah"/>
@dingjing
dingjing / AuthModule.cs
Created February 12, 2014 03:16
Sample implementation of ELMAH http authentication.
using System;
using System.Configuration;
using System.DirectoryServices.AccountManagement;
using System.Net;
using System.Text;
using System.Web;
namespace SecurElmah
{
public class AuthModule : IHttpModule
@dingjing
dingjing / elmah_author_config.xml
Created February 12, 2014 03:04
Configure ELMAH authorization in web.config
<authorization>
<deny users="*" />
<allow roles="Developers" />
</authorization>
@dingjing
dingjing / elmah_auth_config.xml
Created February 12, 2014 03:00
Configure ELMAH authentication in web.config
<httpHandlers>
<add verb="POST,GET,HEAD" path="/admin/elmah.axd"
type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
...
<!-- Deny unauthenticated users to see the elmah.axd -->
<location path="admin">
<system.web>
<authorization>
<deny users="?"/>
@dingjing
dingjing / connectby.sql
Created February 5, 2014 22:24
Generate rows using Oracle "connect by" clause.
select 1 from dual connect by level <= 50;
@dingjing
dingjing / SignalRDemoEditRecordPageOverride.cs
Created January 20, 2014 21:56
SignalR demo call client method from server.
using Microsoft.AspNet.SignalR;
public override void CommitTransaction(object sender) {
base.CommitTransaction(sender);
var hub = GlobalHost.ConnectionManager.GetHubContext<MyHub1>();
hub.Clients.All.refreshAlert();
}
@dingjing
dingjing / signalrdemo.js
Created January 20, 2014 21:44
SignalR demo client code
<script src="../Scripts/jquery-1.6.4.min.js" ></script>
<script src="../Scripts/jquery.signalR-2.0.1.min.js"></script>
<script src="/signalr/hubs"></script>
<script type="text/javascript">
$(function () {
var hub = $.connection.myHub1;
hub.client.refreshAlert = function () {
alert("Data has been updated. Please refresh.");
};
$.connection.hub.start();
@dingjing
dingjing / Startup.cs
Created January 20, 2014 21:39
SignalR demo startup class
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(SignalRDemo.UI.Startup))]
namespace SignalRDemo.UI {
public class Startup {
public void Configuration(IAppBuilder app) {
// Any connection or hub wire up and configuration should go here