Questions tagged [request.servervariables]

Questions regarding ASP ServerVariables Collection

45 questions
8
votes
1 answer

Is Request.ServerVariables["REMOTE_ADDR"] reliable enough?

Currently I am using Request.ServerVariables["REMOTE_ADDR"] to get the IP from the client. What guarantees I get when calling this Method. Or should I look in other ServerVariables as well?
Carlos Muñoz
  • 17,397
  • 7
  • 55
  • 80
6
votes
3 answers

request.serverVariables() "URL" vs "Script_Name"

I am maintaining a classic asp application and while going over the code I came across two similar lines of code: Request.ServerVariables("URL") ' Output: "/path/to/file.asp" Request.ServerVariables("SCRIPT_NAME") ' Output: "/path/to/file.asp" I…
Jiaaro
  • 74,485
  • 42
  • 169
  • 190
6
votes
0 answers

ASP.NET Core 2 Equivalent of Request.Servervariables

This is a little annoying thing. Definitely not a show stopper. What is the equivalent of Request.ServerVariables? Specifically, I would like to know how I get the current URL? I have previously done this by getting…
6
votes
2 answers

How to access ServerVariables in AspnetCore 1.0

In exisiting .Net Web Site, Server Variables is accessed using HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"] How to access the ServerVariables in AspnetCore 1.0 Web Application? While debugging inside controller,…
4
votes
1 answer

C# using HttpListener and Request.ServerVariables on Windows Forms or Console

Project Objectives: Create a local Proxy Judge using a Console or Windows Form application for debugging and testing connections. Project must request and receive proxy ServerVariables to display on client side. Parse IPAddress and return Anonymity…
Nightforce2
  • 1,426
  • 5
  • 18
  • 31
4
votes
3 answers

What is the form collection in asp.net/html?

Simple question but one i need to clarify for myself. In terms of collections that can be accessed in the request object there is: Cookies: (whats in a text file in the browser) Querystring: (whats passed in the url like [key=value&key=value…
Exitos
  • 29,230
  • 38
  • 123
  • 178
3
votes
2 answers

Can i SET a serverVariables in .NET

is it possible to assign a value to a ServerVariable("Something") using the code? instead of doing it via the IIS? something as simple as this? Request.ServerVariables("LOGON_USER")="test" i also found the following at another…
Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129
2
votes
1 answer

Access Mocked Request.ServerVariables in classes

I have mocked Server Variables which are used in Controller. request.SetupGet(x => x.ServerVariables) .Returns(new System.Collections.Specialized.NameValueCollection { {"SERVER_NAME","localhost"}, …
2
votes
3 answers

How do I get server variables (or at least client IP address) in C# in Elmah's ErrorMail_Mailing event when HttpContext.Current is null?

I am working on some error handling code and I want to determine if its a local connection (developer) or not. Typically I look at HttpContext.Current.Request.ServerVariables however in the error handling code if authentication expired…
Aaron Silverman
  • 22,070
  • 21
  • 83
  • 103
2
votes
1 answer

How can I populate/imitate server variables in PHPUnit Test cases using Symfony3?

How can I populate/imitate server variables in PHPUnit Test cases using Symfony3? I try to create functional tests for my symfony3 application. I use LiipFunctionalTestBundle. I have a special $_SERVER variable which contains the country of the…
2
votes
2 answers

Sharepoint stripping HTTP Headers

I have a custom sharepoint app whose security model depends on an HTTP header. When a request is made from the mobile device, an http header called HTTP_RIM_DEVICE_EMAIL is added to each request. I grab the http header via the following…
Dave Harding
  • 1,280
  • 2
  • 16
  • 31
2
votes
1 answer

Request.ServerVariables("LOGON_USER") VS2010 and VS2012

I have encountered with a very peculiar for me thing. I started developing a Web site in Visual Studio 2010 and finished in 2012. It is VB.NET, framework 4.0. Throughout the Web site I use Request.ServerVariables("LOGON_USER"). Everything works as…
2
votes
1 answer

ServerVariables["REMOTE_HOST"] returns internal IP?

Since changing my server hosting to a new provider (ovh), I don't manage to get the client's IP using a simple Request.ServerVariables["REMOTE_HOST"] . It always returns 10.0.1xx.2xx (masked the exact value, don't know if that matters) which seems…
Ranch
  • 2,601
  • 4
  • 29
  • 28
2
votes
1 answer

Setting HTTP_X_FORWARDED_FOR server variable in classic ASP

I need to set the HTTP_X_FORWARDED_FOR value in the Request.ServerVariables collection. I'm trying with Fiddler (see this article). So I set up a custom HTTP request: GET http://myhost/ HTTP/1.1 http_x_forwarded_for: my.fake.ip.1, my.fake.ip.2 Host:…
1
vote
2 answers

asp.net mvc when should i read servervariables?

When is the apropriate time (part of code) that i can gather information from servervariables? I mean, i have tried calling this string temp = Request.ServerVariables.Get("HTTP_REMOTE_USER"); in the Controller constructor, but i am getting a…
Trimack
  • 4,153
  • 9
  • 44
  • 70
1
2 3