SET A ServerVariables In NET?

Mar 22, 2012

Is it possible to assign a value to a ServerVariable("Something") using the code? instead of doing it via the IIS?[code]...

View 2 Replies


ADVERTISEMENT

C# - Servervariables In Asp.net?

Jul 13, 2011

i want to retrive value as below

string server = Request.ServerVariables("SERVER_NAME");
//Declare the form being accessed ex: Default.aspx
string url = Request.ServerVariables("URL");
// Declare the query string in the URL
string querystring = Request.ServerVariables("QUERY_STRING");

but i got a error Non-invocable member 'System.Web.HttpRequest.ServerVariables' cannot be used like a method.

View 2 Replies

Request.ServerVariables From A Webservice (asmx)?

Aug 4, 2011

On my serverside pages (intranet environment), I use the following code to find out which user is using the page:Request.ServerVariables("LOGON_USER")How do I use that command in a webservice (asmx file)? I can't use the line above as I get a message saying that Request is not declared.

View 1 Replies

.net - Request.ServerVariables("REMOTE_ADDR") Retrieving The Same IP For Multiple Logins?

Sep 9, 2010

I've been asked to write code to track IP addresses of visitors to one of my company's online applications in .NET. This is actually the second one I've done, having done another site late last year. I noticed then, and again now, that I sometimes get the same IP address showing up for what I know is another box.....sometimes a co-worker's and sometimes a box not even in this building. The code is pretty straightforward, here's how I get the address:

Dim IPAddress As String = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If IPAddress = "" Then IPAddress = Request.ServerVariables("REMOTE_ADDR")

I log the results to a database upon users logging in. My testing this morning on my development box, of course, yielded 127.0.0.1.....fine, just what I expected. When I deployed the code on our staging server, I got my actual IP address (I've seen it enough to know it when I see it). All fine.....but then a co-worker in our QA group went in to do some testing and MY IP address was logged in the database. I know with certainty that we don't share that address.

I also recall seeing this during my first deployment, when transactions from customers in various states around the US were logged with MY IP address. I'm not seeing things... It's almost like the transaction header is being cached and subsequent calls aren't fetching the new user's info.

View 1 Replies

Asp.net - Request.ServerVariables("SCRIPT_NAME") Not Returning Anything

Mar 11, 2009

Branching off from this link it seems that Request.ServerVariables("SCRIPT_NAME") doesn't return anything. I've just set up a simple loop to see if anything comes out at all but with no luck.

For Each s As String In Request.ServerVariables
Label1.Text += s
Next

ServerVariables brings back a list of Strings in key->value form as defined in System.Collections.Specialized.NameValueCollection

EDIT: It seems to be a problem with getting the ServerVariables from a page using master pages. In my code behind model I'm defining the following:

Public Partial Class Test
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write(Context.Request.ServerVariables("SCRIPT_NAME"))
End Sub
End Class

This doesn't work, quite simply. If I enter the code within the Page_Load event within the .aspx page, however, by doing the following:

<% Response.Write(Context.Request.ServerVariables("SCRIPT_NAME")) %>

View 4 Replies

Request.ServerVariables ("SERVER_NAME")?

May 23, 2009

i am using vb.net 2008 and asp.net.now i have a form which is used to send email from my page on my website.

the code is as follow:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net.Mail" %>
<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)

[code].....

should i replace the "SERVER_NAME" if so what will be its value?Ip address or?what looks like the value of "SERVER_NAME" or what will be its value?

2nd question:

strReferringPage = Request.ServerVariables("HTTP_REFERER")

will i replace "HTTP_REFERER" by something or what will be its value?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved