BTW here is an example of how the old classic ASP handles it:
http://www.4guysfromrolla.com/demos/....UrlEncode.asp
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 ...
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")
BTW here is an example of how the old classic ASP handles it:
http://www.4guysfromrolla.com/demos/....UrlEncode.asp
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
>