473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Server side variables (e.g. $_SERVER['REMOTE_ADDR']) - dotNet equivalent?

What is the equivalent for retrieving server side variables?

For example in PHP, one such predefined variable is: $_SERVER['REMOTE_ADDR']
Dec 28 '07 #1
3 4526
"Frank Moyles" <fg******@nospam.comwrote in message
news:ce*********************@bt.com...
What is the equivalent for retrieving server side variables?

For example in PHP, one such predefined variable is:
$_SERVER['REMOTE_ADDR']

string strRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 28 '07 #2
Mark Rae [MVP] wrote:
"Frank Moyles" <fg******@nospam.comwrote in message
news:ce*********************@bt.com...
>What is the equivalent for retrieving server side variables?

For example in PHP, one such predefined variable is:
$_SERVER['REMOTE_ADDR']


string strRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
The ServerVariables collection is a collection of strings, so just do:

string strRemoteAddr = Request.ServerVariables["REMOTE_ADDR"];

Besides, the collection returns null if there is no item by the
specified name, and calling ToString on a null reference causes an
exception.

--
Göran Andersson
_____
http://www.guffa.com
Dec 28 '07 #3
"Göran Andersson" <gu***@guffa.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
The ServerVariables collection is a collection of strings, so just do:

string strRemoteAddr = Request.ServerVariables["REMOTE_ADDR"];

Besides, the collection returns null if there is no item by the specified
name, and calling ToString on a null reference causes an exception.
You're quite correct - I should have been more specific.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 28 '07 #4

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

Similar topics

5
by: David C. Holley | last post by:
How would I run a JavaScript function in a *.asp page and then pass the value returned to VBScript for further processing? ***Converting the function to VBScript is *NOT* an option.
12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
4
by: Bratislav Jevtic | last post by:
hi, ASP.NET, framework 1.0, patch 2, Windows 2000 server is this possible: from server side to say "go back" to browser? ------------------- scenario: I've got some page with a list. When...
1
by: oreng | last post by:
Hey all, I have some problems detecting whether the client's browser javascript is enabled at the server side. While Request.Browser.JavaScript only check if the browser enable java script (and...
4
by: | last post by:
I use user session to store user-specific data, but how can I store server-side data for the entire web-application? My current solution is to define static fields - or something like that - in a...
4
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
2
by: xeo | last post by:
hey. Am not that advanced in php.. but some how i wanna know how 2 make server side variables, example: lets say i wanna put a clock on the server every 30 mins an action occurs
18
by: Thomas Lunsford | last post by:
I have inherited a set of asp pages that I now need to augment. In order to minimize changes to production code, I would like to make a "call" to an asp page from a new asp page. Existing code is...
5
by: =?Utf-8?B?dXNmaW5lY2F0cw==?= | last post by:
I'm new to asp.net. I'm trying to follow the tutorial walkthroughs and have got a few done. Now I'm doing the one about validating input, and I've run into some problems. In particular, I am...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.