ActionResult没有拿起参数

时间:2016-03-25 17:21:25

标签: c# asp.net-mvc parameters routes

URL:

<?php
$conn=mysqli_connect("localhost", "root", "", "winkcage");
//$im=$_SESSION["pathsession"];
$nam=""; $usernam=""; $phon=""; $pass="";
$nam=$_POST["name"];
$usernam=$_POST["username"];
$phon=$_POST["phone"];
$pass=$_POST["password"];
$signquery="INSERT INTO signup(name, username, phone, password) VALUES('$nam', '$usernam', '$phon', '$pass')";
$signqueryrun=mysqli_query($conn, $signquery);
?>

policyID为null:

http://localhost:49917/Home/CreateInsured/16

当我看到答案时,我很确定会踢自己

2 个答案:

答案 0 :(得分:2)

尝试用

替换它
[Route("Home/CreateInsured/{policyID}")]

[Route("Home/CreateInsured/{id}")]

并在Method中更改参数名称

答案 1 :(得分:0)

为什么自动生成的评论说// GET:Policy / CreateInsured。可能是控制器名称是Policy而不是Home?