创建自定义服务器变量,这可能吗? [英] Create custom server variable, it's possible?

查看:60
本文介绍了创建自定义服务器变量,这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

i想在我的asp.net应用程序中创建一个自定义服务器变量,所以我可以稍后在其他页面(甚至是asp或perl)中检索



request.servervariables(" HTTP_mycustomvariable")

我尝试过response.appendheader(" mycustomvariable"," ; somevalue")但是

这不起作用,或者变量范围仅限于aspx文件,而不是asp

或perl。

所以我的问题有一个解决方案,带有外部vc ++程序的事件?

谢谢,

Michele

Hi all,
i want to create in my asp.net application a custom server variable, so i
can retrieve later in other pages (even asp or perl) with

request.servervariables("HTTP_mycustomvariable")

i''ve tried with response.appendheader("mycustomvariable", "somevalue") but
this doesn''t work, or the variable scope is limited to aspx files, not asp
or perl.
So there is a solution with my problem, event with a external vc++ program?
Thanks,
Michele

推荐答案

如果您真的希望它对应用程序的每个用户都是全局的,那么
想要使用Application对象。请记住,因为它确实是b / b
应用程序级别,它可能会受到多个线程的影响,试图修改它,因此在设置值时需要执行以下操作:


Application.Lock();

应用程序[" AppName"] ="我的应用程序" ;;

Application.UnLock();


现在可以像往常一样从任何

代码隐藏页面检索Application [" AppName"]的值(如果你没有,请注意转换上面的代码)使用C#)。


有更好的一个!


John M Deal,MCP

必要性软件


joun写道:
If you truly want it to be global to every user of the application you
want to use the Application object. Just remember because it is truly
application level it can suffer from multiple threads attempting to
modify it so you need to do the following when setting the value:

Application.Lock();
Application["AppName"] = "My Application";
Application.UnLock();

The value for Application["AppName"] can now be retrieved from any
codebehind page as usual (note convert the above if you don''t use C#).

Have A Better One!

John M Deal, MCP
Necessity Software

joun wrote:
大家好,我想在我的asp.net应用程序中创建一个自定义服务器变量,所以我


request.servervariables(" HTTP_mycustomvariable")
我已经尝试过response.appendheader("),可以在其他页面(甚至是asp或perl)中检索。 mycustomvariable"," somev alue)但是
这不起作用,或者变量范围仅限于aspx文件,而不是asp
或perl。
所以我的问题有一个解决方案,事件有一个外部vc ++程序?
谢谢,
Michele
Hi all,
i want to create in my asp.net application a custom server variable, so i
can retrieve later in other pages (even asp or perl) with

request.servervariables("HTTP_mycustomvariable")

i''ve tried with response.appendheader("mycustomvariable", "somevalue") but
this doesn''t work, or the variable scope is limited to aspx files, not asp
or perl.
So there is a solution with my problem, event with a external vc++ program?
Thanks,
Michele



Response.AppendHeader将变量附加到响应中。响应是

然后发送到浏览器。浏览器不会在其请求中发回您的自定义标头

变量。你将不得不找到另外一种方式来做这件事。
Response.AppendHeader appends variables to the response. The response is
then sent to the browser. The browser wouldn''t send back your custom header
variable in its request. You are going to have to find some other way of
doing this.


是的,但这只适用于asp.net应用程序: asp.net应用程序

变量不与其他应用程序共享....

我需要从perl CGI脚本中读取服务器变量


Yes, but this would work only for asp.net applications: asp.net application
variables are not shared with other applications....
i''ve the necessity of reading a server variable from a perl CGI script
through


这篇关于创建自定义服务器变量,这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆