Introduction of Static Keyword in C#.net

Introduction of Static Keyword in C#.net

Static Class : A static class is you can say same as the non-static class, but there is one difference them is a static class can't be instantiated. In other words, you cannot use the "new" keyword to create a instance variable of the class type. As there is no instance variable, you can access the members of a static class by using the name of the class itself. Static classes and it's class members are used to create data and functions that can be accessed without creating an instance of the class. Static class members can be used to separate data and behavior that is independent of any object identity: the data and functions do not change regardless of what happens to the object. Static classes can be used when data or behavior is not present in the class that depends on object identity. Static classes are loaded automatically by the .NET Framework CLR when that program or namespace containing the class is loaded. The main features of a static class are: static classes can only contain static members. static classes can not be instantiated. static classes are sealed and therefore cannot be inherited.
Regular Expression for FileUpload in asp.net

Regular Expression for FileUpload in asp.net

Collection of Regular expression to validate various file formats :- 1.Regular expression to validate file formats for .mp3 or .MP3 Ex: string str= /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.mp3|.MP3|.mpeg|.MPEG|.m3u|.M3U)$/; 2.Regular expression to validate file formats for .doc or .docx Ex: string str= /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.doc|.docx|.DOC|.DOCX)$/; 3.Regular expression to validate file formats for .txt or .TXT Ex: string str= /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.txt|.TXT)$/; 4.Regular expression to validate file formats for .jpeg or .JPEG or .gif or .GIF or .png or .PNG Ex.
Uploading And Extracting Zip in Asp.net

Uploading And Extracting Zip in Asp.net

Method for uploading and extracting a zip. Note:- 1.Please provide the path for saving the zip,dont copy the same text as it given below. 2.Please do not change any syntax of method you have to only change the destination folder path . public void Upload_And_Extract_ZIP() { if (FileUploadControlID.HasFile) { string filename = Path.GetFileName(FileUploadControlID.FileName); string ext = Path.GetExtension(FileUploadControlID.FileName); string Destination_Folder_Path = “Enter the full folder path where you want to save the zip”;
Payment through paypal in asp.net

Payment through paypal in asp.net

1. For Test First register it and login before payment. https://developer.paypal.com/ 2. Initialize Item for payment //Query String of Item Detail to send item description to paypal private string GetItemDtetail() { string strPayPalUrlType ="https://www.sandbox.paypal.com/cgi-bin/webscr";// For Test string strPayPalUrlType ="https://www.sandbox.paypal.com/cgi-bin/webscr";// For Live string cmd = "_xclick"; string redirect = ""; redirect += strPayPalUrlType; redirect += "?cmd=" + cmd;
Payment through Authorize.net in C#

Payment through Authorize.net in C#

1. Test Card Details Card Number: 4111111111111111 Cvv Code: 123 Exp Date:1013 2. Code // From serverside alert Function protected void jsCall(string alert) { string script = @"alert( """ + alert + @""" );"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsCall", script, true); } private bool AuthorizePayment() {