Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ’ replacement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

’ replacement

 Post Reply Post Reply Page  <123>
Author
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 7:36am
It's not the URL which is giving him a problem. It is inserting ampards into an sql query and executing it.

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 9:24am
Originally posted by zMaestro zMaestro wrote:

oh no :(

the & character gives me error too since it is sent as querystring

how can I replace the & character?


I guess he sends it over the URL before inserting into the database

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 9:38am
Yes but  the error isn't being caused by a & in the URL. Its being caused when he in inserting it into a database. What Datbase are you using? If your using SQL Server consider using Stored Procedures, then you wont have any of these problems.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 11:21am
With asp you will have those problems with SP's as well because there is no way (to my knowledge) to treat sp's paramters as literals. And Semikolon is right, if you have a & in your querystring it give you problems also as it will truncate the QS at that point.
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 11:33am
Instead of using GET, POST the form and you will not have the querystring problem with ampersands.
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 12:04pm
Originally posted by Mart Mart wrote:

Yes but  the error isn't being caused by a & in the URL. Its being caused when he in inserting it into a database. What Datbase are you using? If your using SQL Server consider using Stored Procedures, then you wont have any of these problems.


at least he said it was in the querystring and SQL wont get problems with & as Encoded HTML (which inserts without problems) uses &


If the data comes from a form, use POST instead of GET (as ljamal said), else you may store it in cookies or sessions
Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 3:56pm

it's not a form :(

here is an example:
http://www.egymalls.com/Catalog.asp?Field=Category&Cat=E lectrical%20Appliances&FieldContent=Item&Sub=006-025 -087

If there is the character & as in (Cat=Home & Acessories)it will be corrupt the url.

I see the space &nbsp; is converted into %20
Is there a value for the character & or ' in the same way???

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 4:15pm
%26

Response.Write(use Server.URLEncode("characters")) and you willl get the value working with URLs
Back to Top
 Post Reply Post Reply Page  <123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.