如何解释动作变量 [英] How do I interpret an action variable

查看:110
本文介绍了如何解释动作变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我正在通过阅读别人的代码来学习一些asp.net的工作.他们有一个动作列为action ="/index/keywordsuggestions",用于通过"get"获取3或4个输入的表单.因此,解密后,我知道表单会将变量提交到/index/keywordideas,但是我怎么知道它具体是哪种类型的脚本?我最终到达的URL是www.page.com/search?*variables* ... ...我是否记错了,它将变量提交给搜索"脚本?有人介意向我解释吗?

谢谢,

Suraci

Hello All! I''m working my way through reading someone else''s code to learn some asp.net. They have an action listed as action="/index/keywordsuggestions" for a form which takes 3 or 4 inputs via "get". So, deciphering this, I know the form submits the variables to /index/keywordideas, but how do I know what type of script it is specifically? The URL I end up at is www.page.com/search?*variables* ... so am I mistaken and it submits the variables to the "search" script? Would anyone mind explaining this to me?

Thanks,

Suraci

推荐答案

操作正确完成后,告诉浏览器将表单提交到哪个URL.可以是服务器可以理解的任何形式的URL.通常它将是一个脚本(qqq.aspx或xxx.php或类似的脚本),但是特别是在最近的Web开发实践中,服务器可能会解释无扩展名的URL来运行特定的脚本.

如果这是一个ASPX4网站(或使用MVC等的新版本进行调用),则可能会在索引"类上调用关键字建议"方法.但是,如果不知道服务器的URL映射规则,就无法说出幕后情况.

包含action ="/index/keywordsuggestions"的表格将提交至website.com/index/keywordsuggestions–我认为该页面将信息存储在表单中,然后发出HTTP重定向.另一种可能性是,初始页面上存在一些Javascript,这导致将提交内容发送到操作中的其他URL,但我认为重定向的可能性更大.我认为,如果服务器发送HTTP 302或303,您将永远不会在地址栏中看到原始URL,并且浏览器会默默地接受重定向.
The action, as you correctly worked out, tells the browser what URL to submit the form to. That can be a URL in any form that the server understands – typically it will be a script (qqq.aspx or xxx.php or similar), but particularly with more recent web development practices, the server might interpret an extensionless URL to run a particular script.

If this is an ASPX4 website (or whatever the new build with MVC etc is called) then this will probably call a ''keywordsuggestions'' method on an ''index'' class, for example. But without knowing the URL mapping rules of the server, you can''t tell anything about what''s going on behind the scenes.

A form with action="/index/keywordsuggestions" will submit to website.com/index/keywordsuggestions – I imagine that that page is storing the information in the form and then issuing a HTTP redirect. The other possibility is that there is some Javascript on the initial page which is causing the submit to be sent to a different URL to what''s in the action, but redirection is more likely, I think. I think that if the server sends a HTTP 302 or 303, you never see the original URL in your address bar and the redirection is accepted silently by the browser.


这篇关于如何解释动作变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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