How to submit a pure HTML page, pass parameters, and verify identity

How to submit a pure HTML page, pass parameters, and verify identity
Since the project requires a questionnaire, but the client requires that the title of the questionnaire must be pure HTML tags, so we are faced with a series of problems

1. How to submit the page <br />After the user completes the questionnaire, how to submit the survey results?

2 How to pass parameters to the page <br />After multiple people submit the same questionnaire, when the administrator views the questionnaire, how to pass parameters to ensure that the data seen is the questionnaire of a specified person. In fact, this problem can be solved by using the simplest query string in ASP.NET, but how to pass parameters in pure HTML?

3How to verify user identity <br />Users can answer the questions only after logging in. How to verify whether the user is logged in?
The entire system is implemented using HTML? Can it be done? It doesn't seem possible. After all, the submitted data needs to be saved in the database, which I'm afraid cannot be done with pure HTML.
So the basic idea is to use HTML static web pages for the front end, but csharp code must be used in the back end.

1How to submit a page <br />In fact, pure HTML can be submitted, mainly through the tag form.
For example, the following code, after being submitted to savedata.aspx, can obtain all the data entered by the user, save it to the database after processing, and can be submitted through ajax or through the input type submit tag.

Copy code
The code is as follows:

<input type="submit" value="Submit" />


Copy code
The code is as follows:

<form action="savedata.aspx" method="post">
<p>First name: <input type="text" name="fname" /></p>
<p>Last name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</form>

2 How to pass parameters to the page <br />In ASP.NET, the easiest way to pass parameters to a page is through a query string. However, a pure HTML web page is a static web page without a corresponding background. How to pass parameters? For example, for the same set of questionnaires, Zhang San and Li Si both answered the questionnaires. The administrator wants to view Zhang San's questionnaire. How to reassign Zhang San's answers to the questions in the questionnaire?
Since HTML is a static page, if you want to read data, you must dynamically read the answer through Ajax and then modify the static page. But how do you pass a parameter that represents a person?
In fact, it is still through the query string, but the method of analyzing the query string has changed from the background to the front end, and it becomes to analyze the query string through js, and then read the data through ajax.

Copy code
The code is as follows:

function QueryString(name )
{
var sURL = window.location.search
var re = new RegExp("" +name+ "=([^&?]+)", "ig");
var result = re.exec(sURL);
if(result)
{
var temp = result[0].split('=');
return temp[1] ;
}
else
{
return "";
}
}

Of course, there is another way. Since data is read through the background, the parameters can be obtained according to the information in the Session. However, if there is no relevant information in the Session, it can only be obtained through the query string.
For example, in the example here, the only way is to use the query string.

3 How to verify user identity <br />Since the entire system cannot be completed using only HTML, the front-end display is pure HTML, and the back-end is csharp code, there is naturally a Session, and of course the user identity can be verified. If you need to determine whether a static HTML page is expired, you can call the background method through ajax to determine whether the user is logged in and whether it is expired based on whether the Session exists.

<<:  Tips for creating two-dimensional arrays in JavaScript

>>:  How to mark the source and origin of CSS3 citations

Recommend

How to quickly query 10 million records in Mysql

Table of contents Normal paging query How to opti...

Detailed explanation of unique constraints and NULL in MySQL

Preface A requirement I had previously made, to s...

Share JS four fun hacker background effect codes

Table of contents Example 1 Example 2 Example 3 E...

The table tbody in HTML can slide up and down and left and right

When the table header is fixed, it needs to be di...

CentOS7 uses rpm to install MySQL 5.7 tutorial diagram

1. Download 4 rpm packages mysql-community-client...

Based on JavaScript ES new features let and const keywords

Table of contents 1. let keyword 1.1 Basic Usage ...

Mysql index types and basic usage examples

Table of contents index - General index - Unique ...

This article teaches you how to import CSS like JS modules

Table of contents Preface What are constructible ...

Tips for importing csv, excel or sql files into MySQL

1. Import csv file Use the following command: 1.m...

MySql index improves query speed common methods code examples

Use indexes to speed up queries 1. Introduction I...

How to monitor oracle database using zabbix agent2

Overview In zabbix version 5.0 and above, a new f...

A solution to the abnormal exit of Tomcat caused by semaphore

I'm playing with big data recently. A friend ...

Vue realizes cascading selection of provinces, cities and districts

Recently, I need to implement a cascading selecti...