ColdFusion 9 中的 Cflocation 错误/新功能 - URL 附加两次

发布于 2025-01-04 09:24:22 字数 1177 浏览 2 评论 0原文

当用户登录并重定向到安全页面时,URL 会像列表一样被附加两次。这反过来会导致 404。

(例如:http://uwf .edu/something.cfm,http://uwf.edu/something.cfm

目前,该网站有一个自定义登录标签,我无法编辑该标签,因为我无法控制它。 (这只是一个自定义 cf 标签,允许人们在大学登录。)

我必须在此标签之后进行额外的处理,以验证他们是否有资格登录此特定站点。一旦验证通过,它们就会被重定向到带有 cflocation 的另一个页面。

    <custom login tag>

    <cfinvoke component="#application.path#cfc/security" method = "constructSession" returnvariable = "status">
     .. params excluded..
    </cfinvoke>

    <cfif status eq 1>
    <cflocation url="#someurl_invalid#" addtoken="no" />
    <cfelse>
    <cflocation url="#someurl#" addtoken="no" />
    </cfif>

自定义登录标签已经刷新了当前页面,但我显然不希望这样,因此使用了上述方法来重定向。这在 ColdFusion 8 中有效。

我读了这篇文章: http://www.bennadel.com/blog/2050-Changes-In-CFLocation-OnRequestEnd-Behavior-In-ColdFusion-9-s-Application-cfc.htm

文章给出了我对发生的事情有一些了解......但我不确定如何解决这个问题。 有人有解决办法吗?

When a user logs in and is redirected to a secured page, the url is getting appended twice like a list. This in turn causes a 404.

(example: http://uwf.edu/something.cfm,http://uwf.edu/something.cfm)

Currently, the site has a custom login tag which I am unable to edit as I do not have control over it. (It's just a custom cf tag that allows people to login at the university.)

I have to do additional processing after this tag to verify that they are eligible to login on this particular site. Once they have been verified, they are re-directed to another page with cflocation.

    <custom login tag>

    <cfinvoke component="#application.path#cfc/security" method = "constructSession" returnvariable = "status">
     .. params excluded..
    </cfinvoke>

    <cfif status eq 1>
    <cflocation url="#someurl_invalid#" addtoken="no" />
    <cfelse>
    <cflocation url="#someurl#" addtoken="no" />
    </cfif>

The custom login tag refreshed the current page already, but I obviously do not want that and thus had used the above method to re-direct. This worked in ColdFusion 8.

I read this article: http://www.bennadel.com/blog/2050-Changes-In-CFLocation-OnRequestEnd-Behavior-In-ColdFusion-9-s-Application-cfc.htm

The article gave me some insight as to what is going on...but I am unsure how to fix the issue.
Does anyone have any solutions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一世旳自豪 2025-01-11 09:24:22

由于您无法控制自定义标记,因此您必须解决该问题而不是修复它。

我建议更改代码:

<cfif status eq 1>
<cflocation url="#ListFirst(someurl_invalid)#" addtoken="no" />
<cfelse>
<cflocation url="#ListFirst(someurl)#" addtoken="no" />
</cfif>

它不太漂亮,但无论 URL 是否为列表,它都可以工作。

Since you don't have control over the custom tag, you'll have to work around the issue instead of fixing it.

I would recommend changing the code:

<cfif status eq 1>
<cflocation url="#ListFirst(someurl_invalid)#" addtoken="no" />
<cfelse>
<cflocation url="#ListFirst(someurl)#" addtoken="no" />
</cfif>

It's not pretty but will work whether the URLs are lists or not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文