Solved

pass data between websites asp.net

Posted on 2004-10-20
6
458 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now