Page.Request.QueryString 有一个值,但没有传递到页面

发布于 2024-08-07 14:44:18 字数 305 浏览 13 评论 0原文

尽管没有值作为查询字符串传递,但我们有以下代码返回值“3”。是否有某种方式使“id”卡在服务器内存中(因为它不是特定于用户的)或者“id”是一个特殊值。有什么想法吗?

if (Page.Request.QueryString["id"] != null)
{
Page.Trace.Write("Query String Key Found");
ListItemID = HttpContext.Current.Request.QueryString["id"];
}

这是在 SharePoint 2007 Web 部件中。

We have the following code that is returning a value of "3" although no value is passed as a query string. Is there some way that the "id" is getting stuck in the server memory (since it is not user specific) or is "id" a special value. Any ideas?

if (Page.Request.QueryString["id"] != null)
{
Page.Trace.Write("Query String Key Found");
ListItemID = HttpContext.Current.Request.QueryString["id"];
}

This is in a SharePoint 2007 webpart.

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

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

发布评论

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

评论(4

手心的温暖 2024-08-14 14:44:18

如果 Web 部件位于通过单击上一页中的列表项导航到的页面上;你会看到该列表项的 ID。

If the webpart is on page that was navigated to by clicking a list item from the previous page; you'd be seeing the id of that list item.

云淡风轻 2024-08-14 14:44:18

可能有一个带有参数的帖子(或 GET)对您来说是隐藏的。查询字符串是过去的 GET 变量,没有“卡住”或“服务器内存”。

使用诸如 HTTPAnalyzerFiddler 来分析 HTTP 流量。这将告诉您谁在提出什么请求。
尽管它可能是您在 Sharepoint 中单击的控件的 ID。

There probably is a post (or GET) with parameters somewhere, that's hidden from you. Querystrings are the GET variables that are past along and there is no "stuck" or "server memory".

Use a tool like HTTPAnalyzer or Fiddler to analyze the HTTP traffic. That will show you who's making what requests.
Although it's probably the ID of the control you're clicking on since you're in Sharepoint.

感性 2024-08-14 14:44:18

清除浏览器缓存。

Clear the browser cache.

若水般的淡然安静女子 2024-08-14 14:44:18

通常,当添加 Web 部件时,它可用于输入的所有参数都会分配一个默认值,例如,将 dataformWeb 部件添加到充足的页面并将其绑定到列表。然后打开页面的源码。您会在那里看到一堆参数绑定,它们又可以绑定到查询字符串。如果您的 Web 部件已为 ListItemId 分配了默认值,您可以吗?

或者您实际上正在调试并单步执行这段特定的代码并且 id 查询字符串变量实际上包含 3?如果是这样,我同意其他答案之一,使用 Fiddler 检查打开页面时进行了多少次 http 调用。

Usually, when a webpart gets added, all parameters that it has available for input get assigned a default value, for instance, add a dataformwebpart to an ampty page and bind it to a list. Then open the source of the page. You see a bunch of parameterbindings there, which in turn can be bound to querystrings. Could you if your webpart got assigned a default value for ListItemId?

Or are you actually debugging and stepping into this particular piece of code and the id querystring variable actually contains 3? If so, I agree with one of the other answers, use Fiddler to check how many http calls are made when you open the page.

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