无状态和状态完整协议之间的区别。无状态和有状态协议的示例 [英] Difference between stateless and state full protocol.example of stateless and statefull protocol

查看:155
本文介绍了无状态和状态完整协议之间的区别。无状态和有状态协议的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习ASP.NET。我只想知道如何使用MVC在ASP.NET中使用无状态和状态完整协议。另外,我想知道状态完整协议的真实示例以及它如何保留状态ASP.NET MVC



我尝试过:



我在会话和ViewState中尝试过无状态协议存储信息。

I am learning ASP.NET.I just want to know how to use stateless and state full protocol in ASP.NET using MVC. Also i want to know real example of state full protocol and how it preserve state ASP.NET MVC

What I have tried:

I had tried how stateless protocol store information in session and ViewState.

推荐答案

参见:< a href =http://programmers.stackexchange.com/questions/101337/whats-the-difference-between-stateful-and-stateless> asp.net mvc - 有状态和无状态之间的区别是什么? - 程序员堆栈交换 [ ^ ]。


Http is inherently stateless. So state must be built into your applications

Stateless - There's no memory (state) that's maintained by the program

Stateful - The program has a memory (state)

To illustrate the concept of state I'll define a function which is stateful and one which is stateless

Stateless

//The state is derived by what is passed into the function

function int addOne(int number)
{
    return number + 1;
}
Stateful

//The state is maintained by the function

private int _number = 0; //initially zero 

function int addOne()
{
    _number++;
    return _number;
}


这篇关于无状态和状态完整协议之间的区别。无状态和有状态协议的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆