Previous Next

Thread: Issue with Request.Form()

Last post 05-04-2008 2:34 AM by ViTran. 18 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (19 items) 1 2 Next >

Sort Posts:

  • 04-30-2008, 3:49 PM

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Issue with Request.Form()

    I'm having problems with Request.Form() eliminating spaces between words from the form's input field.

     Here is a sample of the Request.Form() code:

    SGBAT_LN4 = Request.form("G_DIRECT_ORDER-ZZPERS_LN4")

    Say if someone inputs "Hello there people" on the form.  It prints out as "Hellotherepeople."

    Also the form is written in ASP.net and being trasported via url when being submitted and the page recieving the data is written in Classic ASP.

  • 04-30-2008, 11:44 PM In reply to

    Re: Issue with Request.Form()

    I can't think of anything that would cause the spaces to be stripped out except for some code.  I would try

     

    SGBAT_LN4 = Request.form("G_DIRECT_ORDER-ZZPERS_LN4")

    response.write SBBAT_LN4 and see what your value is.

    Steve Schofield
    Windows Server MVP - IIS
    MCTS - Windows Hosting

    http://weblogs.asp.net/steveschofield
    http://www.iislogs.com
    http://www.orcsweb.com/
    Managed Hosting Solutions
    #1 in Service and Support
  • 05-01-2008, 7:09 AM In reply to

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Re: Issue with Request.Form()

    Yea I'm already writing it out using <%Response.write(SGBAT_LN4)%> so that's how I could tell it was stripping the spaces out.......

  • 05-01-2008, 8:55 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Lawrenceville, NJ
    • Posts 3,466
    • tomkmvp

    Re: Issue with Request.Form()

    What type of control is accepting the input on the ASP.NET form, and how is it getting submitted to the ASP page?

  • 05-01-2008, 9:01 AM In reply to

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Re: Issue with Request.Form()

    It's just a form with input fields and being submitted via url encoding to the asp page.

  • 05-01-2008, 9:03 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Lawrenceville, NJ
    • Posts 3,466
    • tomkmvp

    Re: Issue with Request.Form()

    Plain HTML input fields?  Why the URL encoding?

  • 05-01-2008, 9:11 AM In reply to

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Re: Issue with Request.Form()

    No I believe they are asp.net input fields. 

    Reason the URL encoding is because its crossing systems.

  • 05-01-2008, 9:19 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Lawrenceville, NJ
    • Posts 3,466
    • tomkmvp

    Re: Issue with Request.Form()

    So you're using ASP.NET TextBoxes?  Is the form getting submitted with a GET or POST?  If you're using Request.Form on the ASP page, you should be POSTing the data from the form and I don't see a need to URL encode then.

  • 05-01-2008, 9:37 AM In reply to

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Re: Issue with Request.Form()

    We are using post.

    But when I use request.form() it keeps stripping the spaces.

  • 05-01-2008, 10:52 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Lawrenceville, NJ
    • Posts 3,466
    • tomkmvp

    Re: Issue with Request.Form()

    Try it without URL encoding that shouldn't be needed.

  • 05-01-2008, 2:34 PM In reply to

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Re: Issue with Request.Form()

    Even if they changed it to a simple post instead of through the URL then it would still probably do the same thing.  For some reason when its running the "request.form()" function its wanting to strip the %20 from the input field and I'm not sure why.

  • 05-01-2008, 3:18 PM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Lawrenceville, NJ
    • Posts 3,466
    • tomkmvp

    Re: Issue with Request.Form()

    FWIW, in my 10+ years of using IIS I've never heard of this happening, and there's nothing inherent in IIS, ASP, or ASP.NET that would cause this.  Not sure what else to tell you ...

  • 05-01-2008, 9:50 PM In reply to

    Re: Issue with Request.Form()

    I must say I can't reproduce the issue.  I wrote a simple asp.net page and it kept the spaces.  You have something in code, an isapi or module messing with the data.

    Hope the code looks good.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="space.aspx.vb" Inherits="space" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">

    <title>Untitled Page</title>

    Partial Class space

    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    If Page.IsPostBack = True Then

    Response.Write(TextBox1.Text)

    End If

    End Sub

    End Class

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

     

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <br />

    <asp:Button ID="Button1" runat="server" Text="Button" />

     

    </div>

    </form>

    </body>

    </html>

    Steve Schofield
    Windows Server MVP - IIS
    MCTS - Windows Hosting

    http://weblogs.asp.net/steveschofield
    http://www.iislogs.com
    http://www.orcsweb.com/
    Managed Hosting Solutions
    #1 in Service and Support
  • 05-02-2008, 7:01 AM In reply to

    • ViTran
    • Top 500 Contributor
    • Joined on 04-17-2008, 3:56 PM
    • Posts 11
    • ViTran

    Re: Issue with Request.Form()

     Well its going from a ASP.net page to a classic asp page via url encoding the data since its going to be crossing into two systems in two different places.

  • 05-02-2008, 8:26 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Lawrenceville, NJ
    • Posts 3,466
    • tomkmvp

    Re: Issue with Request.Form()

    Please show us the code on exactly how you are doing this.  Again, I don't think there's any need to URL encode the data as it is getting posted and not place in the querystring.  What does URL encoding the data have to do with two systems in two different places?

    Another though I had last night is that within the recipient ASP page you can not reference the form field by it's ASP.NET server control ID.  You have to use something in a format like:

    Request.Form("ctl00$ContentPlaceHolder1$TextBox1")

    Look at the HTML source of your ASP.NET form to find the exact name you should use for the textbox.

Page 1 of 2 (19 items) 1 2 Next >
Page view counter