Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unwanted form action - viewstate problem

Status
Not open for further replies.

boro2g

Programmer
Apr 29, 2005
8
GB
Hi,

I am re-writing the 404 error page for my site to offer a more attractive error state. I have set up IIS so that 404's point to a file /error/404.aspx - this works fine

In this page (404.aspx) I parse the querystring to extract the url that was typed (or linked to) and display this value in a textbox (vm_redirect.Text = parsedURL) - this also works fine.

There is a submit button available to the user, if they want to retry the page (or can amend string)

The code for the section embeds the button and textbox within a form
<form runat="server" id="redirectFormId">
<asp:textbox id="vm_redirect" size="50" runat="server" />
<asp:button id="vm_submit" text="Go" OnClick="redirectForm" runat="server" EnableViewState="false"/>
</form>

I also have my sub fn - redirectForm - this should redirect the user to the new page

Sub redirectForm(ByVal vm_src As Object, ByVal vm_args As EventArgs)
Response.Redirect((vm_redirect.Text).ToString())
End Sub

This however causes a file not found error - if i view the source of the page, the form's action is

Is there any way i can prevent this from happening - so that any 404 leads to /error/404.aspx, but then when the user clicks 'go' - it tries to redirect to the string they have entered

Many thanks in advance
Boro
 
sorry, one v small correction, the enableviewstate is actually on the textbox

cheers
 
turn the enabledviewstate of the button back on?

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Thanks for that, unfort the same problem is still in place - when i view the source of the page, the action attached to the form is still
action="404.aspx?404;
( is the page which causes the 404)

although i want the action to be to redirect the user to the page in the textbox (either set from 404 error, or when the user modifies it)

thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top