How to detect if an aspx page was called from Server.Execute?

前端 未结 6 1447
醉梦人生
醉梦人生 2021-01-13 13:38

I have the following example page structure:

  • Webpage.aspx
  • Script.aspx

If I call Server.Execute(\"Script.aspx\") from Webpa

6条回答
  •  既然无缘
    2021-01-13 13:58

    Since Server.Execute runs the new page with the same context as the original page, all the properties of Request should still reflect the original request to Webpage.aspx (except for CurrentExecutionFilePath, which hopefully contains "/Script.aspx"). Request.Path should contain "/Webpage.aspx", while Request.Url will give the full Uri object if you need to see the domain or querystring.

    You can also add values to Context.Items before calling Server.Execute and read them in Script.aspx

提交回复
热议问题