views:

64

answers:

3

How do I make an asp.net page submit to a specific IP address?

Every time the page submits (during postback) I wish to have it submit to a specific IP address? Is that possible in .net 3.5? Thanks in advance.

+1  A: 

In Asp.Net 3.5 (you must have Visual Studio SP1 installed) you can set the Form's action in the code behind page by using form.Action = 172.21.151.203

Please note that this will only work with the web application model and not on the web site model.

koosk
except that I get ViewState error.http://support.microsoft.com/kb/970459so I am not quite sure why they MS implemented this feature (enabling devs to submit to a different page); since there is no use for it; and it's listed not to work. MS never seems to amaze me in a bad way - all this money and still stupid stupid dev tools.
gnomixa
A: 

If you are relying on the user to interact with a Button for postback operations, then use the Button.PosbackUrl property. You can specify a completely different host.

John K
TreeView doesn't seem to have this property. Any ideas how i can make sure that any postbacks on TreeView are posted to a specific url/ip?
gnomixa
For that specific scenario I can only suggest koosk's answer posted in this same thread - http://stackoverflow.com/questions/1602847/how-do-i-make-an-asp-net-page-submit-to-a-specific-ip-address/1602915#1602915
John K
A: 

How to: Post ASP.NET Web Pages to a Different Page

<asp:Button 
  ID="Button1" 
  PostBackUrl="~/TargetPage.aspx"
  runat="server"
  Text="Submit" />
rick schott