473,769 Members | 4,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create custom server variable, it's possible?

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.serverv ariables("HTTP_ mycustomvariabl e")

i've tried with response.append header("mycusto mvariable", "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

Nov 18 '05 #1
15 5760
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.Loc k();
Application["AppName"] = "My Application";
Application.UnL ock();

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:
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.serverv ariables("HTTP_ mycustomvariabl e")

i've tried with response.append header("mycusto mvariable", "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

Nov 18 '05 #2
Response.Append Header 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.
Nov 18 '05 #3
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
$ENV{'variablen ame'}
that is equivalent to request.serverv ariables("varia blename") for asp.net
Unfortunately there is no method (i suppose) for a perl script to access to
an asp.net application variable, so i have the necessity to set up a custom
server variable....

"John M Deal" <jo******@neces sitysoftware.co m> ha scritto nel messaggio
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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.Loc k();
Application["AppName"] = "My Application";
Application.UnL ock();

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:
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.serverv ariables("HTTP_ mycustomvariabl e")

i've tried with response.append header("mycusto mvariable", "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


Nov 18 '05 #4
If you want some data to be available to multiple applications, store it in
a file or database.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"joun" <jo**@nospam.co m> wrote in message
news:mM******** ************@tw ister1.libero.i t...
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.serverv ariables("HTTP_ mycustomvariabl e")

i've tried with response.append header("mycusto mvariable", "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

Nov 18 '05 #5
Can you not take the approach of cookies?

bill

"joun" <jo**@nospam.co m> wrote in message
news:mM******** ************@tw ister1.libero.i t...
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.serverv ariables("HTTP_ mycustomvariabl e")

i've tried with response.append header("mycusto mvariable", "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

Nov 18 '05 #6
Actually I thought the browser DID send back custom headers in the next
request.

Jeff
"Scott Simons" <Scott.Simons.A t.MealMagic.Com .Remove.This> wrote in message
news:82******** *************** ***********@mic rosoft.com...
Response.Append Header 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.

Nov 18 '05 #7
Unfortunately, the variable i need is for security purposes, so a cookie
can't be used...

"William F. Robertson, Jr." <theman_at_fdrs ucks.com> ha scritto nel
messaggio news:uk******** ******@TK2MSFTN GP11.phx.gbl...
Can you not take the approach of cookies?

bill

"joun" <jo**@nospam.co m> wrote in message
news:mM******** ************@tw ister1.libero.i t...
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.serverv ariables("HTTP_ mycustomvariabl e")

i've tried with response.append header("mycusto mvariable", "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


Nov 18 '05 #8
If you can't use cookies then you shouldn't be using header variables
either as header variables are easy to find with a simple http sniffer.
I'm thinking that you really should go with the suggestion of using a
database or some other shared server side storage location for holding
this value. Anyone that would go to the trouble of opening your cookie
would probably not have too much problem running something like Fiddler
(or any number of other tools) to see what is inside the headers for the
page. Also from a security standpoint, you probably don't want to pass
anything to the client that you are worried about getting hacked, it is
better to keep it at the server and use an authentication mechanism to
get to it each time it is needed. Or is there some other reason that
you prefer a header value over a cookie?

Have A Better One!

John M Deal, MCP
Necessity Software

joun wrote:
Unfortunately, the variable i need is for security purposes, so a cookie
can't be used...

"William F. Robertson, Jr." <theman_at_fdrs ucks.com> ha scritto nel
messaggio news:uk******** ******@TK2MSFTN GP11.phx.gbl...
Can you not take the approach of cookies?

bill

"joun" <jo**@nospam.co m> wrote in message
news:mM****** **************@ twister1.libero .it...
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.serv ervariables("HT TP_mycustomvari able")

i've tried with response.append header("mycusto mvariable", "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



Nov 18 '05 #9
When I tested it, the browser didn't send the header in the request. What
did you use to test this?
Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8102
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure creates a string of custom SQL statement and returns this string back to the main stored procedure. This SQL statements work fine on there own. The SQL returned from the sub stored procedure are returned fine. The datatype of the variable that...
6
3565
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html error page. All six steps in the article work just fine. Then at the end of the article, there is a little comment about redirecting errors to an aspx page (instead of an html page):
0
2517
by: RyanG | last post by:
when the value that determines the filter is databound?? I am trying to make a DropDownList for a set of data that I use a lot throughout my project. So I extended the DropDownList to retrieve from the database a set of data to populate the itself with. Now to make this control as reusable as possible I also added a new property to this Custom DropDownList. With the goal being that this property would be used with the DataView...
8
5041
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my select, remember it, and then use it in the update. It works just fine when I have full control of the whole process. I want to do the same for my GridView/SqlDataSource combinations. I typically select from a view and update the corresponding...
6
12859
by: rithish | last post by:
Is it possible to set a custom server variable so that it may be used in the latter part of a script? Say something like $_SERVER = "myvalue", and then be able to use 'myvar' later. The reason being that I want some client-side information to flow to PHP, and the PHP script flow will be controlled depending on this information.
10
4788
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the value for the parameter of an SqlCommand for inserting the xml document in a column of a table where the column is typed to be of the same xml schema. This all sounds simple, but SQL Server REQUIRES the timezone to be specified for date values....
0
4430
by: Tom | last post by:
I've been trying to install the PECL library libssh2 for secure shell2 functions. I'm on a shared webhost which allows custom php installations that run as a CGI binary. I've been trying to configure libssh2 but I cannot get the server I'm on to find autoconf... it originally was not installed on the server, so I downloaded, unpacked, and installed it successfully to a custom folder in my /home directory (along with autoheader). ...
1
1437
by: mbasil77 | last post by:
I'm trying to create a custom server variable in DOTNET. Is there a way to do this? I know there are MUCH better/easier ways to store session data ... However, I'm dealing with a legacy application that relies on this. Thanks in advance. mb
7
4690
by: ADN | last post by:
Hi, I am creating a custom HTTPModule to intercept the request of when the user is attempting to retrieve a session variable. For instance, if I set a session variable in my code like so: session = "Hello World"; When the request for that session variable "myString" is attempted to be retrieved, I would like to intercept that request like so: if (Request is for session variable "myString")
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.