×

Loading...
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!

还是会有些安全措施的,介绍牛哥一片文章==>

Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / 如果一个web form有N多个dropdownlist,比如要用户选择很多信息去完成一个表格,而这些dropdownlist又需要互相关联,选择了其中一个其他都要做refresh,有什么best practice又简单的方案来处理?
    目前的项目实现的方法很笨,每个dropdownlist通过一个connection来bind一个database table,选择一个dropdownlist就触发SelectedChanged event来做if处理,如果dropdownlist数目比较多,这样的方法估计可以和印度人的40条if语句相媲美了。。。。。。。
    • 有一种技术叫ajax
      • ajax能干这个?how?
        • Just some JS functions on client side, and an entry point on server side. Ajax is not new at all.
          • I know what ajax it is,BTW,can u give some detail how we can handle this via ajax,thanks.
            • I won't give coding details, because that is related to lang you are using. We used J2EE for a small ERP app. Its menu text is dynamically determined by login ID, an req is real-timely sent by ajax to server asking for text.
              aother one is dynamic dropdown list for parts.........

              without ajx, there is no fun in web app dev.
              • thanks.I think I got what I want now.
                • Just be cautious for potential security attack or spam which could be implemented on client side. JS is vulnerable to be used to attack your server, and caused it overloaded with floods of meaningless reqs.
                  • 还是会有些安全措施的,介绍牛哥一片文章==>
                    • 这些不过是表面文章, 一个高手会得到存储于服务器上的living client session IDs, further more, server session id, and hack DB server using injected SQL.
                      这种文章是说给初级听的.
                      • 7,有开始唬上了,说的和JS八竿子打不着的东西。
                        • JS is on the top level of session. Any scripts running on client side is treated seriously as a security loophole for the entire system, especially if this script is not a compiled one, readable, and executable on client side.
                          You don't have advanced IT network security license, do you? Not everyone has this license for sure.
                          • 回你的问题都觉得掉价,你该不是要发布新标准来摒弃了JavaScript吧。
                            • 你这个问题说明你确实没有水准。在IT领域,security issue就像吃饭一样,是个存在。不是高手,心态不好,不用回帖。
                              • 明白了,芙蓉GG原来知道js也没让天塌下来,只是为了要展示一下芙蓉GG的造型。
                                • 讨论的格调需要注意。
                            • 上面说的一点没错,client side script是最薄弱的环节。攻击者可以在用户机器上安装浏览器查检来动态的修改javascript,很容易的绕过诸如“if(n>10)”之类的逻辑。理论上所有跟安全相关的逻辑都应该在server端运行。
                              • 还是会有些安全措施的,介绍牛哥一片文章==> URL -readonly(ReadOnly); 7.18 14:23 (#4564699@0). 说说你的攻击手段?
                                • I can write an ActiveX or Firefox addon and lure user to install it. Once it is installed, I can taken over the control of client side, including modifying javascripts.
                                  • 都是自以为是,我给的文章里的安全措施根本就没在cleint端,换句话说,原来javascript的安全性现状还是那样,根本就没有由于Ajax而改变。
    • 1 只能向下吧。 2. 如你说的,一般refresh一,2个吧,犯不上都吧。3.现在我觉得印度人水平真高。4.search的时候条件语句有点学问。
    • 考虑效率么?我用php做的一个form,内容差不多,估计没你的dropdownlist多,我用php把数据全读出来,扔给js,然后js做剩下的事情。如果你数据多,第一次load可能会久吧
      • 现在数据读的时间不算长,至少没有明显感觉到延迟,用的LINQ。
    • I did that once. All data required are loaded into a xml node in a hidden frame, and JS will read data from xml when dropdown changed.
      • agree. and easy to bind to treeview to see whether more friendly
    • 这个==>
      • that's really cool, i think i will stick on asp.net ajax from now on. thanks a lot!
        • 别把asp.net牵扯进去好不好,没asp什么事。
          • 事大着呢,这些控件和别的asp.net控件一样,都是server端的控件,但封装了ajax的功能。
            • 这些控件封装了ajax实现了一些ajax本身可以实现的功能而已。没asp.net,ajax本身就能轻松实现LZ的要求。
              • 我就是干.net的,你说我会选啥?:)
                • 通常来讲,那些控件就是好好的路不直着走偏要绕着走。
              • 给你个asp.net Ajax的网站看看,这生孩子是两个人的事。
                • AJAX没有出来之前,我用普通Javacript就已经实现上述功能;有了AJAX后,更加灵活地实现上述功能,但从来也不用asp.net。你说这孩子非得找asp.net生么?
                  • 别这么自以为是,
                    给你个具体的例子:国家/省(州)/城市,你不可能把全世界的数据一次加到client端,得选国家后==>到server端拿相应的省(州),拿了相应的省(州)后==>再到server端拿相应的城市。没有server的配合,你client端生啥孩子。没有100%html+JavaScript的Ajax。
                    • 别这么自以为是,
                      Server 端就只能靠asp.net来实现吗?asp.net才多久的东西,它没生出来的时侯,互联网就只能显示一些静态html么?
              • 这点我支持你:我很惊奇有那么多所谓的控件,libraries, etc. Ajax本身就是一个function call, a request, 完全自己可以作出一个light weight structure, 用xml dom做数据的媒介,灵活多变,自己的code. 移植也方便。
                • 按芙蓉GG的观点,导弹就是一炮仗。
                  • 讨论问题,你像个农民工那样心胸狭窄,LZ讨论的,是一种技术的request, 大家在这里讨论的ajax是一种conceptual analysis. 我提的security, 也不过是个 concern。
                    • 说你芙蓉GG一点也没冤枉你,真想讨论技术,先把我给的文章读明白,再提出你的攻击手段。“还是会有些安全措施的,介绍牛哥一片文章==> URL -readonly(ReadOnly); 7.18 14:23 (#4564699@0)”
                      • 和我讨论技术可以,我不嫌弃从芙蓉村里来的年轻人,虽然对谁都叫哥哥。不过,如果自己拣个芝麻,非得争辩是检了个西瓜,我想北大清华这样的学校,不会收他。这里的学校,也不会要他。农民工回去种地一样发财,不用同挤在一条船上。
                        你自己玩吧。
    • 这个是比较典型的AJAX应用, 不过除了不postback之外, 跟你们现在的方法没有本质区别, 该多少个IF还是多少个IF. 要想改进, 得从MVC结构上下功夫.
    • My two cents
      1. Instead of linking data source in database individually for each ddl, it’s better to load a dataset of multi-datatables in one database connection and link each ddl to corresponding datatable in the loaded dataset (You might apply data filter in application layer, if comparing to actual needed data, the total records are not too many.).

      2. You can use an update panel (AJAX.NET) and put all ddls in the panel. So when any ddl’s value is selected, you reload data for these ddls, but instead of refresh whole page, it only refreshes the content in the panel.

      3. Better not directly use JavaScript to load data to ddls on client-side. Otherwise you cannot use server control properties such as ddl.SelectedValue to obtain data, Instead you have to use traditional approach, Request.Form.Get(control_name) (If you are using master page, even it is complicated to get the control name.). And since these data loaded on client-side are saved in viewstate, when page is posted back, you also need rebind data for these ddls. These will mix it with your normal business logic and increase the complexity.
      • thanks for your input. and thanks for all above posters' suggestion. I appreciate these a lot.
        1.Since we are using LINQ now, i have to dig into this.
        2.I already applied update panel for some pages, It doesn't make too much different though.
        3.Javascript/ajax is just for UI layer, all business logical things are in cs files since our system is based on ASP.net 3.5
        • Is the no difference in developing environment or stress test environment?
      • No offense, try to achieve using JavaScript to load data to ddls on client-side, and using ddl.SelectedValue on server side. It's part of Asp.Net Ajax.
        • Creating an Extender Control to Associate a Client Behavior with a Web Server Control
          • You are right. Actually what I wanted to say was .NET is totally different from other server web frameworks.
            People should not simply apply some concepts to it. It needs an intergraded solution.

            Another concern about client-side logic is that the business logic is scattered anywhere. I personally prefer to centralize it in server-side.
      • I may have different opinion of point 1
        you said "Instead of linking data source in database individually for each ddl, it’s better to load a dataset of multi-datatables in one database connection and link each ddl to corresponding datatable in the loaded dataset"

        This may not necessary, the db connection can be in connection pool, so do connection to DB multiple times is not big deal compare to use one connection to get all the data and use application logic to filter out the data.

        supposed we have a client list, site list, unit list.
        one client have multiple sites, one site have multiple units. when user choose one client, we need refresh the site list, when user choose a site, then we need refresh the unit list for this site. we can use ajax but seperate data binding to implement this
        • Any good experienced database developer should understand benefit of put multi-select statements in one query, especially in actual production environment, separated web and database servers, extensive database queries.
          • search google on this topic, don't find prestigious point, any body else have something to say?
            You said:
            "(You might apply data filter in application layer, if comparing to actual needed data, the total records are not too many.).
            "
            the DB size is growing constantly, in one day, you may find your assumption might not correct any more
            • Comparing web server and database server, which one is more expensive?