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


Asmx Webservice Return Multiple Classes Wsdl?

Aug 18, 2011

We are developing a webservice for a client. We are not supose to throw SoapExceptions, so instead, we catch every exception server side, and return a custom Exception class.

Public Class Order
End Class


The problem now is, that since my webmethod is returning the type [Object]. The wdsl that is generated does not contain the order, or the exception.

I can change the [Object] to [Order] Or [MyException], but only one of them is generated in the wsdl.

I want both the MyException type and the Order type in my wsdl, but i just cant get it working.

View 2 Replies

Pass Generic Type Definition To Asmx Webservice?

Feb 8, 2012

I use jQuery ajax calls to ASP.Net web services (ASMX files) to update the web page data.

I have the database storing code seperate from the domain object class code (in the example code below, there is an Animal class and an AnimalRepository class). I'm implememting a convention that all similar domain object repository classes will have a Store method .

I would like to create a web service that can cater for calling the Store method for any one of these repository classes. To get this to work, in the below code sample, the List(Of Animal) parameter would need to be a generic type.[code]...

View 2 Replies

Add Access-Control-Allow-Origin To An ASMX Webservice Have Created In Program?

Nov 5, 2010

I have a very simple ASMX page.[code]...

How do I add Access-Control-Allow-Origin to the response headers so that the webservice can be consumed by multiple websites using AJAX?

View 1 Replies

Translate PHP Json Webservice Request TO .Net Json Webservice Request?

Jun 13, 2011

I have to send a request to Webservice and I have a working PHP solution, that I have to translate in

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.


Naturally I imported a reference to a Json library and Imported (Imports Newtonsoft.Json)?

View 1 Replies

.NET Web Service (ASMX) Shape The Request And Response Messages?

Dec 18, 2009

I'm building a web service to accept notifications from a company. The company informed me that the service is incorrectly structured and provided me the .asmx of a working web service. It looks like this:


<?xml version="1.0" encoding="utf-8"?>


View 2 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, 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 - 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

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
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 2008 and 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)


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

How To Return Base64Binary From A Webservice Request

Dec 7, 2010

How would I return a base64Binary type back from a web service request? I would like to return the base64Binary of a PDF document from the binary datatype from SQL Server 2008. Is base64Binary the same as Byte? Do I have to convert the Byte to Base64 then to String?

View 1 Replies

Wcf - Soap Request Client To Webservice Using .net?

Dec 28, 2011

How do I send/Receive SOAP messages usiung .NET I wanted to invoke a webservice, however not like the way shown in the link above.What I did was, created a service reference with the wsdl url(in a windows application with a button click event)


have created a client object

Dim objProxy As MyClient = New MyClient()

I have populated the objrequest and objreqheader using the below methods, (assigning string values and not xml) = "abcd"

Finally the below line invokes the service

objresponsehead = objProxy.myoperation(objreqheader, objrequest, objresp)

From reference vb, this is the myoperation public function

Public Function myoperation(ByVal RequestHeader As AFA.RequestHeaderType, ByVal GetTransactionDetailsReq As AFA.GetTransactionDetailsReqType, <System.Runtime.InteropServices.OutAttribute()> ByRef GetTransactionDetailsResp As AFA.GetTransactionDetailsRespType) As AFA.ResponseHeaderType


I checked the property of objProxy, it is having basic http binding as the property. Anyone invoked the service like this? From soapui, the response is fine, after i populate the request fields.How can i enable the trace to see what is the request going and where is the problem.

View 1 Replies

C# - Get "type" Of A Request - Web Service (ASMX)

Nov 17, 2011

I want to log the "type of" request that access my simple ASMX page. How would I be able to do this?

TYPE typeofReq = request.Method = WebRequestMethods.Http.Get.GetType();

I just want to know how applications are accessing this web service.

View 1 Replies

C# - Servervariables In

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

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 - Request() Versus Request.QueryString()?

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 - ASMX Web Service Debugging

Mar 16, 2012

How can i turn on debugging when trying to add a service to my app? How can i change the settings to view it remotely? I tried loading up the .asmx page in IE on that server where the file is being hosted and it just asked me to save the file-would never open it to view as a page. That is the error i get when i try to load the .asmx file from my server.

View 1 Replies

How To Jquery Post In Asmx

Jan 10, 2012

Im trying to get a response from a function in a webservice but i dont think i am creating the service correctly.[code]

View 1 Replies

Use Enum In An Asmx Web Service

Jul 7, 2011

I'm writing an asmx web service in visual basic, and I would like to put in my web service an enum that should be available to the web service's callers through the wsdl. But how could that be done? I'm writing my enum in the web service class, but it's not being published in the wsdl. I've already done this kind of thing successfully using C#, but I cannot understand how this is done in VB.

View 1 Replies

C# - Can't Access Class From ASMX Service

Oct 21, 2011

I have a class

Public Class NotifierAuthHeader
Inherits SoapHeader
Public HandlerId As Integer
Public Guid As Byte()
End Class

which I use in webservice in following methods:

<OperationContract()><WebMethod()> _
public Function GetTestNotifierAuthHeader()
Dim testNotifierAuthHeader as NotifierAuthHeader=new NotifierAuthHeader()


I can use GetTestNotifierAuthHeader method at client, but type of return object is..object, not NotifierAuthHeader.asmx service is 3.5 and wpf app is 4.0 c#.

View 1 Replies

C# - Create A Asmx Client For Wcf Service?

Jun 13, 2012

I have some clients calling my asmx service and I figure out to change my asmx to a Wcf service.How can my asmx clients call to my Wcf service without modify the client application?Maybe just a few changes in the config file...I can't expect than they compile their applications.

View 2 Replies

C# - Map A Virtual Directory For *.asmx Methods In ASP.Net 2.0?

Jun 7, 2012

A little while ago, I managed to get WebServices to return JSON as well as XML from the code-behind of an ASPX.

Today, I needed to migrate an existing ASMX WebService to return JSON instead of XML (which was accomplished with little fuss). My problem became evident in testing the new method.

In the code-behind for the ASMX, I created a new method to return JSON instead of XML. The method works, in that it returns the expected JSON however the new routine breaks every XML-returning method in the code-behind (they all throw "System.NotSupportedException: The type System.Collections.Hashtable is not supported because it implements IDictionary." which is unexpected because the return types are all defined as XmlDocument).

If I simply comment out the JSON-returning method, the XML-returning methods function normally. Uncommenting out the JSON-returning method breaks the XML-returning methods again.

While I cannot find any supporting documentation anywhere, this behavior leads me to believe that in ASP.Net 2.0, JSON-returning methods cannot co-exist in the same module as XML-returning methods.

This led me to try separating the methods in sub-classes like so:

<WebService(Namespace:="")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ScriptService()> _


View 2 Replies

Javascript - Return JSON From ASP.NET .asmx?

Nov 5, 2009

I have the following test method:Imports System.Web

Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<System.Web.Script.Services.ScriptService()> _


Even with the ResponseFormat attribute added the response is still being returned as XML rather than JSON.

View 6 Replies

.net - Display Post Data To Web Service Asmx

Jan 14, 2010

I am trying to post data from application to web service asmx that is located on server! For posting data from application I am using this code:


View 1 Replies

Consume A Regular Asmx Web Service In A Dll Project?

Jan 22, 2009

I created a dll project in visual studio 2008, and i dont see the add web reference option, only the Service Reference option whish looks like it takes a WCF not a regular asmx web service, is that correct?

View 3 Replies

Read SOAP XML By ASMX Web Servcie Function?

Feb 14, 2012

I wrote a simple web service (ASMX) function in VB:

Public Function processMessage(ByVal Messages as XMLElement) As String
Dim strS as string
strS = Messages.outerXML
Return strS
End Function

And test by sending the following request (attempt to read two messages):


The problem is that it stops after reading first message and second one never shows up. How can I get it?

View 2 Replies

Send WebBrowser Control URL .asmx Service

Nov 2, 2011

OK I am brand new to .asmx creation and I am having a hell of a time figuring out to send a URL to .asmx file. The .asmx file is expecting to receive a parameter named givenURL.The paremeter givenURL needs to be sent from Windows Forms.I need to know how I go about doing this? Do I use SOAP or can I just send it using VB? [code]

View 1 Replies

Send Data From A Windows Form To An Aspx Page And Send Back A Response - Request.Form Vs Request.BinaryRead?

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


View 2 Replies

ASMX Call - Returning Response Header As XML Instead Of JSON

Dec 29, 2011

My ASMX call is returning Content-Type = text/xml; charset=utf-8
I am using ASP.NET 3.5 and jQuery.Ajax. Have added these things are per numerous suggestions from Stack Overflow. I have done these things

Done this at web.config
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
[Code] .....

But whatever I do, the response header is still of type xml. What part am I missing here?

View 1 Replies

Pagemethod Doesn't Work From Asmx File Rather Aspx?

Jan 25, 2012

I am using simple json method for calling webmethod but it works with aspx file ie url:


but it doesnt work if I put same function in an asmx file and change url to asmx.

Is there anything else have to be done to enable asmx service ?

asmx with vb code: // this works
<%@ WebService Language="VB" Class="WebService" %>
Imports System.Web
Imports System.Web.Services


View 2 Replies

Are There Any Tools To Build ASMX Proxies From Server Side Assemblies

Aug 21, 2009

We have a set of assemblies which implement web services operations.To build the client proxies, we first build and deploy the web services (assemblies and ASMX files) on the server.Then we use wsdl.exe to point to the ASMX endpoints and generate the classes for the client proxies.I've seen that it is possible to create the proxies from wsdl files (instead of asmx endpoints) using wsdl.exe or disco.exe.Is there a tool to generate wsdl files or event better proxy classes directly from the server assemblies without the need to use a web server?

1) This is a somewhat large project that has been in development for over a couple of years now. The decision to use ASMX web services was made before the existence of WCF.

2) I already thought about writing our own proxy generator and that may be an option if we don't find a tool that does it.

3) We still want to bind to the WSDL contract. What I'm trying to avoid is having a dependency on a web server during the build process.

4) We already auto-generate the proxies in our automated build which runs in TFS Build and that has not been an issue per se. The issue, as I was told, is having to split the build in two parts: server & client. There may be alternatives to avoid the split using some fancy MSBUILD task, but my knowledge on that matter is limited.

5) I do expect the build to brake on TFS Build if the client side code and server side code don't match during compilation. That should have been addressed on the developer's machine before check-in.

6) We have strict control over the server and the client parts. This set of web services serve as a back-end to a Click Once Windows Forms application. Everything runs on an intranet. Every time the contract changes, it is done in tandem with a new version of the client application.

7) WCF is not an option in the short term for this set of web services. When I joined the project over a year ago I was given the task of creating a new set of web services for interoperability with other internal systems. Those web services were designed upfront to be easily upgradable to WCF once upper management allowed us to use WCF. I'll have to take a look into svcutil.exe, but if it does what we need, I'll have another point in trying to convince upper management to adopt WCF.

View 4 Replies

Copyrights 2005-15, All rights reserved