Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sending data to other web-app

Reply
Thread Tools

Sending data to other web-app

 
 
Christina N
Guest
Posts: n/a
 
      09-13-2004
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


 
Reply With Quote
 
 
 
 
Shiva
Guest
Posts: n/a
 
      09-13-2004
One option is to use HttpWebRequest to manually post the data to the logging
app.

"Christina N" <> wrote in message
news:...
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



 
Reply With Quote
 
 
 
 
Christina N
Guest
Posts: n/a
 
      09-13-2004
Okay, but HOW do I do that? Can you help me?

Christina



"Shiva" <> wrote in message
news:O%...
> One option is to use HttpWebRequest to manually post the data to the

logging
> app.
>
> "Christina N" <> wrote in message
> news:...
> 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
>
>
>



 
Reply With Quote
 
Shiva
Guest
Posts: n/a
 
      09-13-2004
Hi,
Check these for a sample:
http://www.netomatix.com/HttpPostData.aspx
http://www.codeproject.com/csharp/Ht...t_Response.asp

HTH.

"Christina N" <> wrote in message
news:...
Okay, but HOW do I do that? Can you help me?

Christina



"Shiva" <> wrote in message
news:O%...
> One option is to use HttpWebRequest to manually post the data to the

logging
> app.
>
> "Christina N" <> wrote in message
> news:...
> 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
>
>
>




 
Reply With Quote
 
Sayed Hashimi
Guest
Posts: n/a
 
      09-13-2004
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" <> wrote in message news:<>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem sending mail: Sending the email to the following server failed Luke Java 2 03-15-2007 10:54 AM
sending data to another server and receiving data as response pintu ASP .Net Web Services 0 12-14-2006 09:36 AM
Sending large files from one app to other =?Utf-8?B?15nXldeg15kg15LXldec15PXkdeo15I=?= ASP .Net 3 12-03-2006 09:26 PM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM
sending message to other windows... shahab C++ 1 11-01-2003 02:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57