473,386 Members | 1,743 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,386 software developers and data experts.

Sending data to other web-app

What is the easiest way to make an ASP.Net application send data to another
web-app? For instance I would like APP3 to log user stats from APP1 and
APP2. The applications are located on different IIS servers.

Put in another way, can I send a datastring to another web-app without
having the IE client expecting a post back from that server?

Best regards,
Christina
Nov 18 '05 #1
4 1628
One option is to use HttpWebRequest to manually post the data to the logging
app.

"Christina N" <no@mail.please> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl...
What is the easiest way to make an ASP.Net application send data to another
web-app? For instance I would like APP3 to log user stats from APP1 and
APP2. The applications are located on different IIS servers.

Put in another way, can I send a datastring to another web-app without
having the IE client expecting a post back from that server?

Best regards,
Christina

Nov 18 '05 #2
Okay, but HOW do I do that? Can you help me?

Christina

"Shiva" <sh******@online.excite.com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
One option is to use HttpWebRequest to manually post the data to the logging app.

"Christina N" <no@mail.please> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl...
What is the easiest way to make an ASP.Net application send data to another web-app? For instance I would like APP3 to log user stats from APP1 and
APP2. The applications are located on different IIS servers.

Put in another way, can I send a datastring to another web-app without
having the IE client expecting a post back from that server?

Best regards,
Christina

Nov 18 '05 #3
Hi,
Check these for a sample:
http://www.netomatix.com/HttpPostData.aspx
http://www.codeproject.com/csharp/Ht...t_Response.asp

HTH.

"Christina N" <no@mail.please> wrote in message
news:ei**************@TK2MSFTNGP14.phx.gbl...
Okay, but HOW do I do that? Can you help me?

Christina

"Shiva" <sh******@online.excite.com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
One option is to use HttpWebRequest to manually post the data to the logging app.

"Christina N" <no@mail.please> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl...
What is the easiest way to make an ASP.Net application send data to another web-app? For instance I would like APP3 to log user stats from APP1 and
APP2. The applications are located on different IIS servers.

Put in another way, can I send a datastring to another web-app without
having the IE client expecting a post back from that server?

Best regards,
Christina


Nov 18 '05 #4
Christina,

Here is a code snippet that shows how to use HttpWebRequest to call
your App3.

// From APP1 or APP2
-----------------------------------------------------------------------------------------------------
string strData = "data=call-from-app2";

HttpWebRequest httpWebRequest=httpWebRequest =
(HttpWebRequest)WebRequest.Create("App3URL");
// call with a POST
httpWebRequest.Method = "POST";

// POST name-value pairs
String contentType = "application/x-www-form-urlencoded";
httpWebRequest.ContentType = contentType;
// write to the request stream
byte[] data = new ASCIIEncoding().GetBytes(strData);
Stream reqStream = httpWebRequest.GetRequestStream();
reqStream.Write(data,0,data.Length);
reqStream.Close();
// execute the request synchronously
HttpWebResponse httpWebResponse =
(HttpWebResponse)httpWebRequest.GetResponse();
-----------------------------------------------------------------------------------------------------

The above will take care of you passing data to App3. Now, will you be
writing App 3 too, or does that
code already exist? If you will write App 3 yourself, then, you can
get to the request input stream and
process the input data that your wrote to the stream above. You can do
the following:
Stream inputStream = new StreamReader(Request.InputStream);

// You can get to the header, params, etcs of the request by doing the
following:

// ---------------HTTP HEADERS-----------------
int i=0;
for(i=0; i<Request.Headers.Keys.Count; i++)
{
Console.WriteLine(Request.Headers.Keys[i]+"="+Request.Headers[Request.Headers.Keys[i]]);
}
// ---------------HTTP PARAMS-----------------
for(i=0; i<Request.Params.Keys.Count; i++)
{
Console.WriteLine(Request.Params.Keys[i]+"="+Request.Params[Request.Params.Keys[i]]);
}
---------------SERVER VARIABLES------------
for(i=0; i<Request.ServerVariables.Keys.Count; i++)
{
Console.WriteLine(Request.ServerVariables.Keys[i]+"="+Request.ServerVariables[Request.ServerVariables.Keys[i]]);
}

One final note about what you are doing. If you are logging request
info for every request, then I recommend that
you write an HttpModule to encapsulate that from the rest of the
application. Writing HttpModules to handle
this is the way to go. Give me some more information on what you want
to do and I will help you along a bit more.
sayed
"Christina N" <no@mail.please> wrote in message news:<eJ**************@TK2MSFTNGP09.phx.gbl>...
What is the easiest way to make an ASP.Net application send data to another
web-app? For instance I would like APP3 to log user stats from APP1 and
APP2. The applications are located on different IIS servers.

Put in another way, can I send a datastring to another web-app without
having the IE client expecting a post back from that server?

Best regards,
Christina

Nov 18 '05 #5

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

Similar topics

5
by: PerryG | last post by:
We have a .NET 1.1 client which is sending a gzipped soap request using HttpWebRequest to an Apache server. The Apache server is using a the 'mod_deflate' server to decompress the incoming...
1
by: Zaidan | last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA code (I will consider using javascript if I have to) that does the following, at the user command: 1- Start MS Explorer and...
2
by: anonymous | last post by:
Hi, I'am sending an xml string to a web service(which is written in c#) using the microsoft web services behavior. When I check this string from the web service I observed that some of the...
5
by: Glenn Wilson | last post by:
I am writing a network system for project I am working on. How would I send a class or structure to the clients and recieve one back. Or how would I go about building a packet with a header and...
5
by: Vishal | last post by:
Hello, I already asked this question in the ASP.NET forums, but no help came. So I am hoping that somebody can help me out. This is really very URGENT me. For my e-commerce application, I...
2
by: Trond Hindenes | last post by:
Hello all, I am working on a application for analyzing data from a SQL Server Database using vb.net. THe application will mostly be web-based, although we migt use some Windows Forms for some of...
7
by: John Bailo | last post by:
I wrote a c# web service that sends an XmlDocument as a return type. When I run it on a w2k iis machine, it takes 35s to 45s to send the data to a client (I wrote a smart client c# app to consume...
2
by: Jonathan Woods | last post by:
Hi there, I have encountered problem of losing data sending over internet using web service. I consume web service that connected Oracle Database. I submit 687 SOAP Messages to 1 Web Method...
2
by: satnamsarai | last post by:
Using System.Net.Mail: Sometimes I get error 'failure sending mail. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.' Not sure how...
5
by: ofiras | last post by:
Hi everyone, As far as I know, you cannot connect directly to a SQL Server database from a web browser application because of the security restrictions. Is there any other way to connect to a SQL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.