how to post resized images to another webpage on different server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nilamshah
    New Member
    • Mar 2013
    • 6

    how to post resized images to another webpage on different server

    I have created re sized image from image which lies in folder of my web application. temporary i have stored this images into another image folder of my application. But i don't want to store that image into folder. I want to post that image and image name directly to another webpage of different application.

    how to do that?

    It would be great if some one provides me with solution code on current page from which re sized image needs to post and target page code...

    Thanks in advance..
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That depends on the other website. Your best bet is to talk to the administrators of that site to see if they offer an API that will allow you to do so.

    Comment

    • nilamshah
      New Member
      • Mar 2013
      • 6

      #3
      Thanks Rabbit,

      But if i want to test it locally first then how would i do... just take an simple example upload image and same image need to post (doesnt matter to store it in same application folder or not but it should get to another webapplication page.

      please help ....

      Thanks in advance

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You can test it locally however you want. But unless you can match the target site's environment, all that testing would be wasted time.

        Comment

        • nilamshah
          New Member
          • Mar 2013
          • 6

          #5
          bbut i dont know how to do code in asp.net for that even it for local testing


          so can you tell me the way for that...If it so then it would be great help....:)

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            I don't think you understand what I'm trying to say. Doing it any which way is pointless unless you match the target site's environment.

            Sure, I can help you code how to transfer one image from one location to another. But all that work would be a waste of time. Because whatever configuration I set up for you to do so would probably not match the real world situation. So we can go ahead and spend weeks doing this. But when you go to do the real thing, all those weeks you spent will not help you.

            Comment

            • nilamshah
              New Member
              • Mar 2013
              • 6

              #7
              Thanks I understand your point but still i want to try it for local host... I have expand issue in further post..hope u may help in that regards.

              Comment

              • nilamshah
                New Member
                • Mar 2013
                • 6

                #8
                I have created re sized image from image which lies in folder of my ASP.Net web application. temporary i have stored this images into another image folder of my application. But i don't want to store that image into folder. I want to post that image and image name directly to another webpage of different application.

                how to do that?

                It would be great if some one provides me with solution code on current page(Default.as px) from which re sized image needs to post and target page(Testreceiv e.aspx) code...

                Default.aspx is in My Webapplication1 and

                TestReceive.asp x is in my Webapplication2

                I write code to post Image on source page as below...I am not sure about it.. If it is correct code then how to receive image on target page ???? Here folder contains the path of the file in which it lies and Fname is name of the image file.

                And if it is wrong then please help me to solve this problem...

                Thanks in advance..


                Code:
                  ASCIIEncoding encoding = new ASCIIEncoding();
                
                                string postImg = folder + Fname;
                
                                byte[] data = encoding.GetBytes(postImg);
                
                                HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:51399/TestReceive.aspx");
                
                                myRequest.Method = "POST";
                
                                myRequest.ContentType = "application/x-www-form-urlencoded";
                
                                myRequest.ContentLength = data.Length;
                
                                Stream newStream = myRequest.GetRequestStream();
                
                
                                newStream.Write(data, 0, data.Length);
                
                                newStream.Close();
                  
                                HttpWebResponse response = (HttpWebResponse)myRequest.GetResponse();
                
                                StreamReader reader = new StreamReader(response.GetResponseStream());
                 
                                string tmp = reader.ReadToEnd();
                
                                response.Close();
                
                                Response.Write(tmp);

                Comment

                Working...