最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Request.Form與Request.QueryString使用
controler控制器代碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace asp.net_mvc_Demo2.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            #region Request.QueryString
            ////第一步,設置與前臺交互
            ////Request.QueryString,用于method的“Get”獲取的是前臺輸入的查詢字符串,
            ////http://localhost:27123/Home/Index?key=1245
            //string str = Request.QueryString["key"];//返回的是查詢字符串中“?”后的數(shù)值
            ////第二步:業(yè)務邏輯處理
            //str = str ?? string.Empty;//新語法,如果str為空則返回string.Empty否則則為str
            ////第三步:將數(shù)據(jù)返回前臺
            //ViewData["demo"] = str;
       
            #endregion
            #region Request.Form使用
            //Request.Form中使用的是Method的方式是“post”,得必須提交給服務器,例如使用submit表單
            string str1 = Request.Form["txt"];
            str1 = str1 ?? "獲取值為空";
            TempData["demo1"] = str1; 
            #endregion
            return View(); 
        }

    }
}
View視圖代碼
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>





    
    Index


    
        
<%--            <%:ViewData["demo"] %>--%>             <%:TempData["demo1"] %>                                   
    

網(wǎng)頁題目:Request.Form與Request.QueryString使用
標題路徑:http://fisionsoft.com.cn/article/gsgehh.html