Solved

pass data between websites asp.net

Posted on 2004-10-20
6
459 Views
Last Modified: 2012-06-21
Hi,
I am using asp.net. I wanted to pass data from form fields. I have a file Webform1.aspx and its corresponding c# file Webform1.aspx.cs

In Webform1.aspx.cs i have
------------------------------------------------------------------------------------

            public void Button1_Click(object sender, System.EventArgs e)
            {
                  Server.Transfer("WebForm2.aspx");
            }

            public void Button2_Click(object sender, System.EventArgs e)
            {
                  
                  Response.Redirect("http://peacock.com/asp-scripts/data_test.asp?TextBox1=" + TextBox1.Text,true);
            
                  
            }
      
--------------------------------------------------------------------------------------------------
well in the method button2_click(...) i use the response.redirect method to call the webpage on some other website.As u can i pass fields as  querystring.

I was wondering if there is a way so that i  dont have create a querystring and post the form. u know something like
Response.Redirect("http://peacock.com/asp-scripts/data_test.asp",true); and still have the form fields post onto the target website's webpage.

BTW i can't get Server.Transfer(..) method to call a webpage on some other website.
Lemme know if u need more info

Thanks in advance
Rajiv.
0
Comment
Question by:rajiv11
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
Rejojohny earned 25 total points
ID: 12367595
u could do a redirect from the client-side using "document.location.href" instead of the "redirect" statement from code-behind . this client-side function could be called by window_onload .. so basically all ur controls would be created and values would be accessible from the redirected page using the standard "request.form" method ...
0
 
LVL 7

Assisted Solution

by:mantarae
mantarae earned 25 total points
ID: 12372713
we handled this situation with JavaScript.

we added a function:

function PostToPage( f, loc ){
      f.__VIEWSTATE.name = '';  //viewstate was screwing up the post, cause it was really long
      f.action = loc;
      f.submit();
}


then in our button, we added this code:

onclick="PostToPage( document.forms[0], 'http://peacock.com/asp-scripts/data_test.asp' );"
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12746936
Please do have a look at my comments .. it will work ...
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question