# Using ' in asp forms

**URL:** https://forum.kirupa.com/t/using-in-asp-forms/183920
**Category:** programming
**Created:** [March 31, 2006, 7:33am UTC](https://forum.kirupa.com/t/using-in-asp-forms/183920 "2006-03-31T07:33:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pucca](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@pucca](https://forum.kirupa.com/u/pucca)
#### Post date: [March 31, 2006, 7:33am UTC](https://forum.kirupa.com/t/using-in-asp-forms/183920/1 "2006-03-31T07:33:57Z")

</div>

MAJOR Problem!  
I’ve developed a competition for one of my clients, and they kept telling me that they get complaints from some of them, when they enter, they get a “page cannot be displayed”… It’s NEVER happened on my side, so we figured out what the problem is :  
One of the answers had a ’ (apostrophe) in the sentence… So, whenever you enter and you press the submit button, it gives you that error… In IE its an HTTP 500 internal server error.  
What must I do to prevent this happenening?

Please help… Think I’m on the verge of loosing my job here… eeeeek!!!:crying:

---

<div class="post-metadata">

### Author: ![maurits](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@maurits](https://forum.kirupa.com/u/maurits)
#### Post date: [April 1, 2006, 2:50pm UTC](https://forum.kirupa.com/t/using-in-asp-forms/183920/2 "2006-04-01T14:50:31Z")

</div>

If the data from the form is inserted into a database (Access, MSSQL, etc.) then the apostrophe causes an internal server error because the SQL query is affected by the apostrophe. This is widely discussed problem and it is called ‘SQL injection’. Have a look at the following

```auto

string myValue = "I'm God";
string query = "INSERT INTO table(value) VALUES ('"+myValue+"')";

```

Then the query would be:

```auto
INSERT INTO table(value) VALUES ('I'm God');

```

As you can see this will raise a SQL syntax error. That is what your internal server error is coming from. Have a look at this page for information on how to solve the problem:

[http://www.4guysfromrolla.com/webtech/061902-1.shtml](http://www.4guysfromrolla.com/webtech/061902-1.shtml)

Good luck, and I hope you can keep the job!

Maurits

---

<div class="post-metadata">

### Author: ![Seb\_Hughes](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Seb\_Hughes](https://forum.kirupa.com/u/Seb_Hughes)
#### Post date: [April 1, 2006, 7:09pm UTC](https://forum.kirupa.com/t/using-in-asp-forms/183920/3 "2006-04-01T19:09:24Z")

</div>

asp is evil. Php 😃

---

<div class="post-metadata">

### Author: ![GPP](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@GPP](https://forum.kirupa.com/u/GPP)
#### Post date: [April 1, 2006, 7:28pm UTC](https://forum.kirupa.com/t/using-in-asp-forms/183920/4 "2006-04-01T19:28:05Z")

</div>

^  
Your 2000 post and you wasted it…

---

<div class="post-metadata">

### Author: ![Ankou](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ankou/32/1351_2.png) [@Ankou](https://forum.kirupa.com/u/Ankou)
#### Post date: [April 1, 2006, 8:08pm UTC](https://forum.kirupa.com/t/using-in-asp-forms/183920/5 "2006-04-01T20:08:55Z")

</div>

> [@Crayon-Inc](#):
>
> ^  
> Your 2000 post and you wasted it…

I’m not sure about that, saying asp is evil and to use PHP is worth it. 😃
