Asp.net prevents external data submission

Source: Internet
Author: User
To prevent data from being submitted outside of the site, is to prevent data from being submitted from outside the site to the site. That is, if data page is not the site page for sending data, it is prohibited to receiving data.

The first method isCodeAdd enableviewstatemac = "true" at the top to prevent data from being submitted from outside the website. For example:

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "common. aspx. cs" inherits = "manage_common" enableviewstatemac = "true" %>

This method basically solves the problem.

The second method isProgramTo prevent data from being submitted outside the website:

String server_v1 = convert. tostring (request. servervariables ["http_referer"]);
String server_v2 = convert. tostring (request. servervariables ["SERVER_NAME"]);
Int Changdu = server_v2.length;
If (server_v1.substring (7, Changdu )! = Server_v2)
{
Add a prompt to prohibit data from being submitted outside the website
}
Else
{
Add the program after submitting data from the website
}

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.