navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

" ' " in web address

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> " ' " in web address
Page: [1]
 
jenleo26

 

Posts: 6
Joined: 1/26/2005
Status: offline

 
" ' " in web address - 1/26/2005 10:39:16   
I have a page that uses sessions with people's email addresses. I have ran across someone using jane.d.o'connor as an address and it's giving me errors. Is there a way around this?

Here is an example of the full address:

http://reporting.com/mylist.asp?email2=Jane.D.O'Connor@reporting.com

Thanks!
Jen
rdouglass

 

Posts: 9186
From: Biddeford, ME USA
Status: offline

 
RE: " ' " in web address - 1/26/2005 11:35:36   
Hi and Welcome to Outfront.

Yes, apostrophes need to be dealt with but it's relatively easy using the replace function:

<%myEmailVariable = replace(myEmailVariable,"'","''")%>

Don't get confused by all the single and double quotes; it goes:

myEmailVariable,comma,double,single,double,comma,double,single,single,double

See if we replace a single apostrophe with 2 apostrophes, we can get the DB to accept it. That any help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jenleo26)
jenleo26

 

Posts: 6
Joined: 1/26/2005
Status: offline

 
RE: " ' " in web address - 1/26/2005 13:40:28   
Thank you very much!

One question, will it still query the database for the correct email address - the one that contains the single quote?

(in reply to rdouglass)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: " ' " in web address - 1/26/2005 13:48:53   
Yes - although without searching for the rfc, Id suggest the user has an invalid email address to start with.

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to jenleo26)
rdouglass

 

Posts: 9186
From: Biddeford, ME USA
Status: offline

 
RE: " ' " in web address - 1/26/2005 13:53:47   
quote:

One question, will it still query the database for the correct email address - the one that contains the single quote?


That's a "qualified" YES. :):)

It will actually store the email address properly (with only 1 apostrophe) but when you search for it, you'll need to use that REPLACE thing again in your query.

This is a very common thing to with SQL injection and all. In fact, I usually build a function like so:

<%
Function StripQuote(TextIn)
TextIn=Replace(TextIn,"'","''")
StripQuote=TextIn
End Function
%>

And use it like so:

UPDATE myTable SET myEmailField = '" & StripQuote(myEmailVariable) & "' WHERE .....

You will not have to use it when your displaying it in the browser (or reading it FROM the DB).

That answer the question?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jenleo26)
jenleo26

 

Posts: 6
Joined: 1/26/2005
Status: offline

 
RE: " ' " in web address - 1/26/2005 19:47:17   
Yes, Thank You!!

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> " ' " in web address
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts