现在我有一个文件夹,里面有另一个文件夹.这两个文件夹名称称为"pc details"和"pchardwaredetails"
当在"pchardwaredetails"的页面上时,我想使用按钮和response.redirect()返回"pc details"中的页面,但文件路径对我来说太复杂了.文件路径可能是从"pchardwaredetails"中名为"Details"的页面到"pc details"中名为"viewMore"的页面?
另外,请随时解释路径是如何工作的,所以我知道将来
谢谢
Llo*_*oyd 22
通常Referrer页面(HTTP标题)告诉你你来自哪个页面,所以回去你应该能够:
Response.Redirect(Request.UrlReferrer.ToString());
Run Code Online (Sandbox Code Playgroud)
这是假设你came来自PC Details.但是,如果您从某个其他页面land开启PC Hardware Details然后无效,则必须对后端功能进行硬编码.
您可以简化ASP.NET路径并使用~,例如:
Response.Redirect("~/some/path/pc_details.aspx");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
44239 次 |
| 最近记录: |