Stop quoting me - CSharp

This is a discussion on Stop quoting me - CSharp ; I'm rewriting some old asp code in c# and I'm having trouble with some values I'm getting from a querystring. The problem is when the querystring has a single quote in it. I'm using server.urlencode in my aspx file but ...

+ Reply to Thread
Results 1 to 3 of 3

Stop quoting me

  1. Default Stop quoting me

    I'm rewriting some old asp code in c# and I'm having trouble with some
    values I'm getting from a querystring. The problem is when the
    querystring has a single quote in it. I'm using server.urlencode in my
    aspx file but it doesn't do anything with that quote. The old asp file
    changes it to %27 which is what I want. Why won't this work for me?
    Here is my aspx file:
    <%@ Page Language="C#" %>
    <html>
    <head>
    <script runat=server>
    void SubmitBtn_Click(Object sender, EventArgs e)
    {
    string text1 =
    Server.UrlEncode(Request.QueryString["title"].ToString());
    Message1.Text=Request.QueryString["title"].ToString();
    Message2.Text=text1;
    }
    </script>
    </head>
    <body>
    <form runat="server">
    <asp:Button id="Button1"
    Text="Submit"
    OnClick="SubmitBtn_Click"
    runat="server"/>
    <p>
    <asp:label id="Message1" runat="server"/><BR>
    <asp:label id="Message2" runat="server"/>
    </form>
    </body>
    </html>

    The only way I can get this to work is (yuch!):
    Server.UrlEncode(sTitle).Replace("'", "%27")


  2. Default Re: Stop quoting me

    BTW here is an example of how the old classic ASP handles it:
    http://www.4guysfromrolla.com/demos/....UrlEncode.asp


  3. Default Re: Stop quoting me

    I'm glad the ASP days are over. yea to .net

    "ian" <polenz_ian@yahoo.com> wrote in message
    news:1138726552.203271.63560@g14g2000cwa.googlegroups.com...
    > BTW here is an example of how the old classic ASP handles it:
    > http://www.4guysfromrolla.com/demos/....UrlEncode.asp
    >




+ Reply to Thread

Similar Threads

  1. Need help with quoting
    By Application Development in forum TCL
    Replies: 8
    Last Post: 11-16-2007, 05:44 PM
  2. Quoting style in C
    By Application Development in forum C
    Replies: 2
    Last Post: 07-13-2007, 06:04 AM
  3. another quoting thing
    By Application Development in forum Mutt
    Replies: 2
    Last Post: 04-04-2007, 02:16 PM
  4. (more quoting hell)
    By Application Development in forum awk
    Replies: 4
    Last Post: 01-05-2006, 04:51 PM
  5. [4.31] Quoting color
    By Application Development in forum Pegasus
    Replies: 13
    Last Post: 01-04-2006, 10:06 AM