gpt4 book ai didi

c# - 如何从库类中获取调用页面名称

转载 作者:太空宇宙 更新时间:2023-11-03 18:44:36 25 4
gpt4 key购买 nike

在一些图书馆类中,有没有办法确定哪个网页调用它,而不必传入调用页面对象?

最佳答案

请参阅此处给出的答案:Get current System.Web.UI.Page from HttpContext?

You're looking for HttpContext.Handler. Since Page implements IHttpHandler, you'll obtain a reference to the currently executing page.You'll have to cast it, or at least try to cast it to the particular type you're looking for.

关于c# - 如何从库类中获取调用页面名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5576939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com