Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8637181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:24:51+00:00 2026-06-12T10:24:51+00:00

I`ve got a link in a Webforms page which opens in a new window,

  • 0

I`ve got a link in a Webforms page which opens in a new window, and posts to a form other than the page itself. This is done like this:

JS:

var submitFunc = function(){
    document.forms[0].action = 'http://urlToPostTo/somePage.aspx';  
    document.forms[0].target = '_blank'; 
    document.forms[0].submit();
}

The link:

<input type="hidden" id="myDataId" value="12345" />     
<a href="javascript:submitFunc();">Search</a>

As you can see, this overrides the target of the main <form>, and attempts to post to a different page. The whole point is that this should post/submit to a different page, while avoiding passing the data of “myDataId” as a Get parameter.

The above code would work, but causes an error due to viewstate validation.

Question: Is there any way for me to either satisfy the requirements here, or somehow bypass the viewstate validation so I can post my data this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:24:53+00:00Added an answer on June 12, 2026 at 10:24 am

    Sounds like you just need to change the PostBackUrl of the button that submits the form.

    A simple example PostToPage1.aspx that posts to PostToPage2.aspx (instead of a postback):

    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="text1" runat="server" /><br />
        <asp:TextBox ID="text2" runat="server" />
        <asp:Button ID="btn1" runat="server" PostBackUrl="~/PostToPage2.aspx" />
    </div>
    </form>
    

    You can then inspect the Request in PostToPage2.aspx to check if it’s a POST, etc. and then access the Request.Form collection in the Request in Page_Load.

    An overly simplified sample for PostToPage2.aspx (do add proper validation):

    if (!Page.IsPostBack && Request.RequestType == "POST")
        {
            if (Request.Form != null && Request.Form.Keys.Count > 0)
            {
               .....
    

    Hth…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a link on the web page that causes new browser window (tab)
i got a jquery code from this link (end of page): How to scroll
I got to link which says that it cant be done in iOS 4.
I got this script called rapidshare link checker v2 php by Bigfish At the
Here is link where i got a code for web-page content fetching. But i
I got the example in this link . I can't understand the addmove ,
I got this code in order to build an url for the link using
I've got a link I want to appear on my page, <a>add another</a> But
I've got this link <a href=/Admin/Product/Brands class=newButton></a> Without the class attribute and a little
I did a quick search and got this link From StackOverflow I get this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.