How to restrict the size of files uploaded in Asp.net

Where the size of the uploaded file is controlled in Web. config: CopyCode The Code is as follows: Maxrequestlength is the maximum size of the parameter request to control the upload size (in kilobytes ). The default size is 4096 KB (4 MB ).

Using segments in ASP. NET to obtain URL File Names

For example: http://www.abc.com/book/list.aspx, you must obtain list.aspx. Generally, we can write as follows: CopyCodeThe Code is as follows: String url = request. url. tostring (); String r = URL. substring (URL. lastindexof ('/') + 1 );

Highlight the selected string or text in asp.net richTextBox

The instance verification is as follows: Copy codeThe Code is as follows: private void highlighted (string to search for strings) { // First locate the start position of the string to be searched Int start position = richTextBox phrase display.

Implementation Code of Asp.net using HttpModule to compress and delete blank Html requests

At the same time, we can delete some blank spaces. Segment, empty line, comment, etc. to make the HTML document smaller. Let's first compress and delete the blank class, inherit from the Stream class: Copy codeThe Code is as follows: // ///

ASP injection prevention

The following are four functions that are sufficient for your defense against all SQL injection vulnerabilities! You can understand the code. You must filter all request objects, including request. cookie, request. ServerVariables, and other

Comprehensive asp anti-CC attack code sharing

Copy codeThe Code is as follows: Dim CC_Info (4), strInfo, strTemp If Session ("CC_Info") = "" Then CC_Info (0) = "cclog.txt" 'Log File Name CC_Info (1) = Request. ServerVariables ("HTTP_X_FORWARDED_FOR ") CC_Info (2) = Request. ServerVariables

The problem in asp.net that dropdwonlist cannot obtain the value

Front-end controls: Copy codeThe Code is as follows: Publish topic: Data Binding: Copy codeThe Code is as follows: SourceDb DropDwonListData = new SourceDb ();String DropDwonSelect = "SELECT * FROM [Section]";SectionDropDownList. DataSource =

Implementation Code of JSON returned by ASP. NET or WebService

Sample Code download: http://zsharedcode.googlecode.com/files/JQueryElementDemo.rar The content in this article is as follows: * Preparation* General handler/ashx* Prepare WebService/asmx If you want to return JSON through ashx or asmx, You need to

Use Asp.net to Operate Excel to implement code more easily

1. Operate the dynamic link library of Excel 2. Create a common class for the dynamic link library for convenient calling. (ExcelHelper) The details are as follows: Copy codeThe Code is as follows: using System; Using System. Data; Using System.

Asp.net ajax implements no-refreshing Verification Code

1. First, the event code in Page_Load of the aspx file of the background verification code: Copy codeThe Code is as follows: using System; Using System. Collections. Generic; Using System. Linq; Using System. Web; Using System. Web. UI; Using System.

Some Usage of ASP. NET Eval Value Calculation

// Bind a field // implement automatic numbering Common method (the best performance of these three methods) Other usage // If the attribute is of the string type, ToString () is not required. Example of DataBinder. Eval usage The format

Implementation of ASP. NET scheduled tasks (implemented by. net internal mechanism without using external programs)

Follow these steps: 1. Make the following changes in the Global. asax file: Copy codeThe Code is as follows: void Application_Start (object sender, EventArgs e) { // Code that runs when the application starts // Define the timer // 1000 indicates

ASP. NET_SessionId in ASP. NET WebService

Today, I am helping my colleagues solve the Web References call problem for WebService: when the first webservice method Method1 is called, the server Set-Cookie: ASP is found. NET_SessionId = ***** saves ASP.. NET session status. Then, when I call

Use DataReader in asp.net for efficient Paging

Share the paging code of the two methods 1. Use DataReader for paging Copy codeThe Code is as follows: // /// PageList for DataReader /// /// /// /// /// /// /// /// /// Public DataTable PageListReader (string connectionString,

Code for customizing the value of asp.net gridview

In model: Copy codeThe Code is as follows: public function item ($ items, $ name ){ $ ReturnValue = ''; Foreach ($ items as $ n => $ item ){ If (isset ($ this-> $ name )){ If ($ n ==$ this-> $ name ){ $ ReturnValue = $ item; } } } Return $

Asp.net gridview implements full selection, inverse selection and deletion of record operation code

Select All gridview operations Copy codeThe Code is as follows: 'columns' => array ( Array ( 'Class' => 'ccheckboxcolumn ', // 'Header' => 'select all ', // 'Value' => '$ data-> id ', // 'Checked' => 'true ', 'Htmlopexception' => array ( 'Width' => '

Asp.net Method for changing the pageSize of the gridview

You can use the following three methods: 1. view Copy codeThe Code is as follows: $ provider = $ model-> search (); $ Provider-> pagination-> pageSize = 20; $ This-> widget ('zii. widgets. grid. CGridView ', array ( 'Id' => 'link-grid ',

Solution to bind TextBox carriage return event in asp.net

1. Bind the carriage return events on the page to the buttons. Copy codeThe Code is as follows: function EnterTextBox (e) { Var msie = (document. all )? True: false; Var keycode; If (! Msie) keycode = window. event? E. keyCode: e. which; Else

Asp.net TIDFtp usage

1. Connect to the remote server Procedure Connect (AAutoLogin: boolean; const ATimeout: Integer ); 2. Change the Directory Procedure ChangeDir (const ADirName: string ); 3 download Procedure Get (const ASourceFile: string; ADest: TStream; AResume:

Implementation Method and instance code for binding a database to the DataList control in asp.net

Solution 1: Datalist databind () Solution 2: View detailed description on MSDN Solution 3: Use a table in a DataList template, for example: Copy codeThe Code is as follows: Database bound to DataList Control Database bound to DataList

Total Pages: 1800 1 .... 1542 1543 1544 1545 1546 .... 1800 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.