Posted in Asp.Net, Cookie on August 30, 2007 | Leave a Comment »
Read-Write a Cookie
==================
Write Cookie
—————-
HttpCookie myCookie = new HttpCookie(“UserSettings”);
myCookie["Font"] = “Arial”;
myCookie["Color"] = “Blue”;
myCookie.Expires = DateTime.Now.AddDays(1); // Set the Cookie Expiration Time
Response.Cookies.Add(myCookie);
Read Cookie
—————
if (Request.Cookies["UserSettings"] != null)
{
string userSettings;
if (Request.Cookies["UserSettings"]["Font"] != null)
{
userSettings = Request.Cookies["UserSettings"]["Font"];
}
}
Read Full Post »
Posted in Sql Server on August 23, 2007 | Leave a Comment »
In Sql FOR XML command can be used in different way..
The most flexible is FOR XML EXPLICIT.
This command option used to generate XML from table
Cosider one table named tblProductMaster , the structure of table is
tblProductMaster (ID , ProductName)
Now write the following command
SELECT 1 AS TAG,
NULL AS PARENT,
ID AS [Product!1!ID!ELEMENT],
ProductName AS [Product!1!ProductName!ELEMENT]
FROM tblProductMaster FOR XML EXPLICIT
It will [...]
Read Full Post »
Posted in Asp.Net on August 22, 2007 | Leave a Comment »
Dynamically change web.config file
==============================
Description
// Suppose you want to remove a handler from ‘httpHandlers’
// and you want to remove modules from your ‘httpModules’
// section of you web.config file..
// Below, this is suppose your web.confile file’s sections
<httpHandlers>
<add verb=”GET” type=”DJ.Blog.FileUpload.UploadProgressHandler, FileUploadLibrary” path=”DJUploadProgress.ashx” />
</httpHandlers>
<httpModules>
<add name=”DJUpload” type=”DJ.Blog.FileUpload.UploadModule, FileUploadLibrary”/>
</httpModules>
Code
// Now, you want to remove both section from you web.config file.
// Using [...]
Read Full Post »
Posted in Questions, Remoting on August 18, 2007 | Leave a Comment »
What’s a Windows process?
It’s an application that’s running and had been allocated memory.
What’s typical about a Windows process in regards to memory allocation?
Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or [...]
Read Full Post »
Posted in Asp.Net, Questions on August 18, 2007 | Leave a Comment »
ASP.NETInterview Questions
=========================
Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
What’s the difference between [...]
Read Full Post »
Posted in C#, Questions on August 18, 2007 | 2 Comments »
C# Interview Questions
====================
This is a list of questions I have gathered from other sources and created myself over a period of time from my experience, many of which I felt where incomplete or simply wrong. I have finally taken the time to go through each question and correct them to the best of my ability. [...]
Read Full Post »
Posted in Encrypt Decrypt on August 13, 2007 | Leave a Comment »
Encrypt – Decrypt with DES Algorithm
================================
// Use this Namespace
using System.Security.Cryptography;// Encrypt Function
public static string Encryption(string value)
{
if (value != “”)
{
DESCryptoServiceProvider CryptoProvidor = new DESCryptoServiceProvider();
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, CryptoProvidor.CreateEncryptor(Key_64, Iv_64), CryptoStreamMode.Write);
StreamWriter sw = new StreamWriter(cs);
sw.Write(value);
sw.Flush();
cs.FlushFinalBlock();
ms.Flush();
return Convert.ToBase64String(ms.GetBuffer(), 0, Convert.ToInt32(ms.Length));
}
return string.Empty;
}
// Decrypt Function
public static string Descryption(string value)
{
if (value != “”)
{
DESCryptoServiceProvider CryptoProvidor = new DESCryptoServiceProvider();
Byte[] [...]
Read Full Post »
Posted in Uncategorized on August 11, 2007 | Leave a Comment »
The following code example demonstrates the standard formatting specifiers for numbers, dates, and enumerations.
C#==
// This code example demonstrates the String.Format() method.// Formatting for this example uses the “en-US” culture. using System;class Sample{enum Color {Yellow = 1, Blue, Green};static DateTime thisDate = DateTime.Now; public static void Main(){// Store the output of the String.Format method in a [...]
Read Full Post »
Posted in Validation on August 8, 2007 | 1 Comment »
Sample Example of Custom Validator to check Length of Textbox
=======================================================
1. Create Javascript function
function CheckLength(events, args)
{
var x = (document.getElementById(txtSKU).value);
if(x != ”)
{
if(x.length < 5) { args.IsValid = false; } else { args.IsValid = true;}
2. Use one Custom Validator
EnableClientScript=”true” Display=”None” ClientValidationFunction=”CheckLength”
3. Declare Variable in CS file
Page.ClientScript.RegisterStartupScript(this.GetType(), “CustomValidationTestForSKU”, “var txtSKU=’” + this.txtSKU.ClientID + “‘;”, true);
Read Full Post »
Posted in .Net Framework on August 7, 2007 | Leave a Comment »
.NET Framework Conceptual Overview
=============================
The .NET Framework is an integral Windows component that supports building and running the next generation of applications and XML Web services. The .NET Framework is designed to fulfill the following objectives:
To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed [...]
Read Full Post »