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
var result = ""; | |
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString)) | |
{ | |
connection.Open(); | |
using (SqlCommand cmd = new SqlCommand(@"SELECT * FROM Table WHERE Id = @Input", connection)) | |
{ | |
cmd.Parameters.Add("Input", SqlDbType.Int).Value = 1; |
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.Text; | |
using System.Threading.Tasks; | |
using System.Configuration; | |
namespace browser | |
{ | |
public partial class Default : System.Web.UI.Page |
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
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Ajax.Default" %> | |
<!DOCTYPE html> | |
<html> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> |
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
ScriptManager.RegisterStartupScript(this, this.GetType(), "CallMyFunction", "MyFunction();", true); |
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
Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","MyFunction()",true); |
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 MySession | |
{ | |
// private constructor | |
private MySession() | |
{ | |
Property1 = "default value"; | |
} | |
// Gets the current session. | |
public static MySession Current |
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
// given, a password in a string | |
string password = @"1234abcd"; | |
// byte array representation of that string | |
byte[] encodedPassword = new UTF8Encoding().GetBytes(password); | |
// need MD5 to calculate the hash | |
byte[] hash = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(encodedPassword); | |
// string representation (similar to UNIX format) |
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 (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString)) | |
{ | |
connection.Open(); | |
using (SqlCommand cmd = new SqlCommand(@"SELECT * FROM Table WHERE Id = @Input", connection)) | |
{ | |
cmd.Parameters.Add("Input", SqlDbType.Int).Value = 1; | |
cmd.ExecuteNonQuery(); | |
} |
NewerOlder