使用MVC,asp.net,是否可以使用URL查询字符串创建一行?(With MVC, asp.net, is it possible to create a row with URL Query S

编程入门 行业动态 更新时间:2024-10-27 06:22:25
使用MVC,asp.net,是否可以使用URL查询字符串创建一行?(With MVC, asp.net, is it possible to create a row with URL Query String?)

例如,我希望能够发送my.url / movie?title =“a”&rating =“b”并在电影表中使用适当的数据创建一个新行。

这可能吗?

我尝试过的一种方法是创建movie.aspx,它也有movie.aspx.cs和movie.cs,可以解析信息。 我可以发送带有相关信息的帖子请求吗?

我是asp.net,mvc和c#的新手。

For instance, I'd like to be able to send my.url/movie?title="a"&rating="b" and create a new row in the movie table with the appropriate data.

Is this possible?

One method I've attempted is creating movie.aspx which has movie.aspx.cs and movie.cs as well which can parse the information. Could I then send a post request with the relevant information, maybe?

I'm incredibly new to asp.net, mvc, and c#.

最满意答案

当然,在使用示例URL触发的控制器中,为Movie构建一个如下所示的处理程序:

public ActionResult Movie(string title, string rating) { // do your work here return View("SomeViewHere"); }

其中SomeViewHere是您想要在完成时重定向到的视图。

Certainly, in the controller that is fired with the example URL, build a handler for Movie that looks like this:

public ActionResult Movie(string title, string rating) { // do your work here return View("SomeViewHere"); }

where SomeViewHere is the view you want to redirect to when you're done.

更多推荐

movie,new,send,电脑培训,计算机培训,IT培训"/> <meta name="description&qu

本文发布于:2023-07-16 00:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1120965.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   字符串   net   asp   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!