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
ADVERTISEMENT
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
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
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
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
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
Jul 5, 2010
I have recently started using Request("key") instead of Request.QueryString("key") to access my querystring values. However I have read that:
'Gets the specified object from the System.Web.HttpRequest.Cookies, System.Web.HttpRequest.Form, System.Web.HttpRequest.QueryString, System.Web.HttpRequest.ServerVariables'
Therefore, if I have a querystring key and cookie key which are the same, which value is returned?
View 1 Replies
Mar 29, 2012
Im trying to send data from a Windows Form to an aspx page and send back a response. Im running around in circles trying to make this work. The data im trying to send is 4 strings. So fare I have this in my code, using the build-in webclient in visual studio 2010, in the windows form sending to the aspx
[Code]...
View 2 Replies
Jan 5, 2011
I have recently started using Request("key") instead of Request.QueryString("key") to access my querystring values. However I have read that:
'Gets the specified object from the System.Web.HttpRequest.Cookies, System.Web.HttpRequest.Form, System.Web.HttpRequest.QueryString, System.Web.HttpRequest.ServerVariables'
[code].....
View 1 Replies
Jul 6, 2010
My Request.Form keys are all prefixed with ctl00$container name$ and then the key I want.How can I get the regular key name working?
Visual example from the immediate window:I want to use:
? request.Form.Item("stationIdea")
but it won't work because the key is:
ctl00$content_innovation_body$stationIdea
as retrieved by
? request.Form.Keys("4")
so only this works:
? request.Form("ctl00$content_innovation_body$stationIdea")
View 1 Replies
Jun 13, 2011
I have to send a request to Webservice and I have a working PHP solution, that I have to translate in VB.net
Here's the code working in PHP
//fill in the details of the contacts.userId is obtained from loginResult.
$contactData = array('lastname'=>'Valiant', 'assigned_user_id'=>$userId);
//encode the object in JSON format to communicate with the server.
[code]....
Naturally I imported a reference to a Json library and Imported (Imports Newtonsoft.Json)?
View 1 Replies
Nov 1, 2008
i have created one script in vb.net which request webpage from server and parse it. initially Application making request to server and server response it too properly .But after making around 80 to 85 request i got following error in my code.
Code:
ex = {"The remote server returned an error: (400) Bad Request."}
But i am able to access all webpage more than 85 if i use browser.
View 2 Replies
Apr 21, 2010
Ok, Can i use, a if statement in VB net?
Like If (textbox1.text = ("Username")) && (textbox2.text = ("Password")); Make form blank or open another form?
View 4 Replies
Mar 24, 2011
I want to make two request to submit a form of another web application. How can I create post and get request. And how can I use secure this.PS. I don't want to create ajax request. Just httpwebrequest.
View 1 Replies
Oct 5, 2009
I am using VB.NET
My problem is that, I have got below request.querystring
http:[url]......Now I want to pass all the above three querystring in a sql stored procedure parameter.for example,
Try
Dim conString As String = WebConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString
Dim con As New SqlConnection(conString)[code]....
But I am able to get the request querystring value in my parameter.
View 2 Replies
Sep 28, 2010
I am building an app where i need to request user name and enter it into the database along with some other fields.
Is there an easy way to request a username using vb.net?
ie username = 'Home/JimJones'
View 1 Replies
May 28, 2011
Exception Details: System.Web.HttpException: Request is not available in this context.[code]
View 3 Replies
Mar 26, 2012
I'm attempting to login to a cPanel using a POST Request in VB.Net. I have the correct credentials when logging in and when posting I still get an 'Unauthorized (401)' response when it should be '301' (analysed using Tamper Data Firefox Add-On). Below is my post request information and function.[code...]
View 1 Replies
Jun 2, 2009
I'm attempting to update a legacy VB6 component (not written by me) to the .NET platform. There is one function which posts an XML string to a URL:
Function PostToUrl(ByRef psUrl, ByRef psData, Byref psResponseText, ByRef psErrorMsg, ByRef psUsername, ByRef psPassword)
On Error Resume Next
Dim objWinHTTP
[CODE]...
I've updated this to:
Public Function PostXml(ByVal XML As String) As Boolean
Try
Dim URL As String = My.Settings.NTSPostURL
'TODO: supply username and password! '
[CODE]...
However when I run the .NET code the server returns the error '403 Forbidden - protocol error' on the line: Using Response As HttpWebResponse = DirectCas (HTTPRequest.GetResponse(), HttpWebResponse). The VB6 code runs fine. identify any discrepancies between the two that might be causing this?
View 4 Replies
Nov 14, 2009
I have an ASP.net page which has fields for filtering a dataset. When I apply the filter (through a button), the results load fine. If I navigate to another page (on the same session), and then come back to the page, I'm re-setting the value of the filter fields on page load
View 9 Replies
Aug 3, 2009
I need to get the host out of the Request object. Which property should I use and why?
From MSDN:Uri.DnsSafeHost Property A String that contains the unescaped host part of the URI that is suitable for DNS resolution; or the original unescaped host string, if it is already suitable for resolution.
vs
Uri.Host Property A String that contains the host name. This is usually the DNS host name or IP address of the server.
My testing has been with the ASP.NET Development Server. Both of these always return localhost. Even when I put in 127.0.0.1, both return localhost.Reading on, the DnsSafeHost property will handle IPv6 addresses, as well as Unicode to ASCII conversion if needed. It can also account for IRI and IDN. Even though I currently don't care about these things, should I just use the DnsSafeHost property to be safe?
View 1 Replies
Jan 5, 2009
I am writing a program to try and centralise alot of data i have on my network so i can use them as templates and guides. My intension was to have an easy to browse program with links in the program which open the particular file (eg. Word document, excel spreadsheet, pdf file etc).I have very limited programming knowledge and in my research i came across this code in VB which allows the program to open the determined file:
Public Class _010101ProgramTemplate
Dim procstart As New ProcessStartInfo("explorer")
Private Sub btnProgTemp01_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProgTemp01.Click
Dim winDirProgTemp01 As String = System.IO.Path.GetDirectoryName("g:Project Management SystemPMS TemplatesSetupProgramDD-IFC PROGRAM.xls")
[code]....
View 1 Replies
Nov 29, 2011
I cant grab the whole response because it is 200 MB- what can I do to JUST GET THE URLHere is my code:
Dim request1 As HttpWebRequest = DirectCast(HttpWebRequest.Create(urlvimeohd), HttpWebRequest)
request1.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like
[code].....
View 1 Replies
Oct 8, 2009
I am using visual studio 8, using vb.net. I am trying without success to make a post request to a web form as shown below.
[Code]....
I dont think that I am posting the right information. Am i supposed to post just the information or do I post the the tags and the information/
View 2 Replies
Dec 2, 2011
In my page URL, there is a property taskgrpid - In my code I would like to use the value as an integer. Listed below is the URL from the page and here is my request for the string
View 1 Replies
Oct 5, 2011
Working on a program that makes use of a third party API. That API can be found here:[URL]I'm a beginning/intermediate VB.Net developer, and have written other programs, but not using something like this. I suspect I'll need to create a Web.Request (Secure) object and 'POST' to the URL with a stream of XML text. That's the general idea, right? The actual URL is internal to our network and I have that information of course.
View 9 Replies
Dec 26, 2010
I have this code to make a Request to my ftpserver
Imports System.Net
Imports System.IO
Module Module1
Sub Main()
[Code]...
View 1 Replies
Nov 4, 2010
I found the below sample to retrieve webpages. I need to request a lot of pages from the same website which requires authentication. Because there are a lot of pages to retieve I like to speed up the requests and like to avaoid to send the credentials and also the certificate. Is it somehow possible to stay connected?
[Code]...
View 1 Replies
Jul 28, 2011
Is it possible to create a request password on a combo box? Ideally I would like to create a number pad which comes up and prompts the user to enter thier password once they try to edit the data in the combo box?
View 2 Replies
Mar 16, 2011
I,m creating a website that checks to see if the User's browser supports png images at startup.I found this Script in Javascript:
function CheckBrowser()
{
[code].....
View 2 Replies