【问题标题】:Best way to implement an expiring link, httpwebresponse.expired?实现过期链接的最佳方法是 httpwebresponse.expired?
【发布时间】:2019-06-18 16:15:37
【问题描述】:

我一定使用了错误的搜索词,因为这一定是一个超级简单的问题,但我没有得到任何有意义的搜索结果。我正在发送一个指向将要过期的页面的链接。 MY 脚本检查链接是否仍然有效。有效时我没有问题,但无效时我找不到简单的响应,而是不断阻止自己编写一百行代码。

我想在子 Page_Load() 中放置一个简单的 response.error。 response.error(“过期”)?类似的东西?我可以做一个 response.redirect 但这意味着一个新的错误处理程序页面。有什么超级简单的吗?如果链接无效,我不希望页面上的任何其他代码执行。

【问题讨论】:

    标签: vb.net httpwebresponse


    【解决方案1】:
    Dim IsValid as Boolean = YourScriptThatCheckForValidLink()
    If Not IsValid Then
        Response.Write("This link has expired.")
        HttpApplication.CompleteRequest()
    End If
    

    【讨论】:

      【解决方案2】:

      不确定是什么问题,但我在任何地方都找不到 HttpApplication,IIS 总是说它无法识别它。

      结束了

          response.write ("<HTML><head></head><body>This Link has expired</body></HTML>")
          response.end()
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-09-18
        • 2018-10-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多