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

Why web page encoding uses utf-8 instead of gbk or gb2312?

If you have a choice, you should use UTF-8 In fac...

Briefly understand the two common methods of creating files in Linux terminal

We all know that we can use the mkdir command to ...

JavaScript Html to implement the mobile red envelope rain function page

This article example shares the specific code of ...

MYSQL uses Union to merge the data of two tables and display them

Using the UNION Operator union : Used to connect ...

CSS achieves the effect of aligning multiple elements at both ends in a box

The arrangement layout of aligning the two ends o...

Pure CSS to achieve click to expand and read the full text function

Note When developing an article display list inte...

MySQL optimization strategy (recommended)

In summary: 1. Consider performance when designin...

How to install pip package in Linux

1. Download the pip installation package accordin...

In-depth understanding of Vue's data responsiveness

Table of contents 1. ES syntax getter and setter ...

Vue implements a scroll bar style

At first, I wanted to modify the browser scroll b...

How to align text boxes in multiple forms in HTML

The form code is as shown in the figure. The styl...

Mybatis mysql delete in operation can only delete the first data method

Bugs As shown in the figure, I started to copy th...

Detailed explanation of using Vue.prototype in Vue

Table of contents 1. Basic Example 2. Set the sco...

Linux centOS installation JDK and Tomcat tutorial

First download JDK. Here we use jdk-8u181-linux-x...

jQuery realizes the shuttle box function

This article example shares the specific code of ...