This file contains hidden or 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
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<title>Sample Angular Client for Basic Authentication</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- Place favicon.ico and apple-touch-icon.png in the root directory --> |
This file contains hidden or 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
angular.module('app').directive('loginDialog', function () { | |
return { | |
templateUrl: 'app/templates/loginDialog.html', | |
restrict: 'E', | |
replace: true, | |
controller: 'CredentialsController', | |
link: function (scope, element, attributes, controller) { | |
scope.$on('event:auth-loginRequired', function () { | |
console.log("got login event"); | |
element.modal('show'); |
This file contains hidden or 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
<div class="modal h1"> | |
<div class="h2 container alert-info modal-body" data-backdrop="static"> | |
Login<br /><br /> | |
<div class="alert-danger">{{error}}</div> | |
<ng-form class="form-horizontal"> | |
Username: | |
<input class="form-control" ng-model="username" /> | |
Password: | |
<input class="form-control" type="password" ng-model="password" /> | |
<br /> |
This file contains hidden or 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
/** | |
* $http interceptor. | |
* On 401 response - it stores the request and broadcasts 'event:auth-loginRequired'. | |
*/ | |
angular.module('app').config(function ($httpProvider) { | |
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | |
var interceptor = ['$rootScope', '$q', function (scope, $q) { | |
function success(response) { |
This file contains hidden or 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
// If the request was unauthorized, add the WWW-Authenticate header | |
// to the response. | |
private static void OnApplicationEndRequest(object sender, EventArgs e) | |
{ | |
var response = HttpContext.Current.Response; | |
// see if the request sent an X-Requested-With header (Non-Browser request - | |
// used by jQuery and Angular implementations to prevent the browser from | |
// presenting the default Login dialog) | |
var request = HttpContext.Current.Request; |
This file contains hidden or 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
Dim lightState as trafficLightEnum | |
lightState = trafficLightEnum.Yellow | |
If lightState = trafficLightEnum.Red Then | |
Vehicle.Stop() | |
Else If lightState = trafficLightEnum.Green Then | |
Vehicle.Go() | |
Else If lightState = trafficLightEnum.Yellow Then | |
Vehicle.FloorIt() | |
End If |
This file contains hidden or 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 Enum trafficLightEnum | |
Red | |
Yellow | |
Green | |
End Enum |
This file contains hidden or 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
C1GridView1.Columns.ColumnByName("Age Allocated").Visible = Mid(C1, 40, 1) = "Y" |
This file contains hidden or 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
If Mid(C1, 40, 1) = "Y" Then | |
C1GridView1.Columns.ColumnByName("Age Allocated").Visible = True | |
Else | |
C1GridView1.Columns.ColumnByName("Age Allocated").Visible = False | |
End If |
This file contains hidden or 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
C1 &= IIf(chkRailCar.Checked, "Y", "N") |