473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

About Error

I am writing program. it get the Source code of site.
for example; site.com/news.asp?id=55 I get the source code. But if I
try the get site.com/news.asp?id=55'a or site.com/news.asp?id=55a it
give me ERROR 500. AND the program NOT GET the Sources code. Soo in
explorer i Uncheck the SHOW FRIENDLY ERROR. so I can seee that

Microsoft OLE DB Provider for SQL Server error '80040e14'

Unclosed quotation mark before the character string 'a '.

like that. BUt in my Program I WANT to get this error Too.. In my
code. It always gooing exception.. :((
StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192];

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();

string tempString = null;
int count = 0;
do
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Encoding.ASCII.GetString(buf, 0, count);
sb.Append(tempString);
}
Application.DoEvents();
}
while (count > 0);
resStream.Close();
response.Close();

if (File.Exists(dosya) == true) { File.Delete(dosya); }
StreamWriter writer = File.CreateText(dosya);
writer.WriteLine(sb.ToString());
writer.Close();
}
catch (Exception)
{
MessageBox.Show("Connection Failed !!"+url,"NO !!");
}

Feb 18 '06 #1
5 1116
Could you post your complete source?
It sounds as though you are passing the querystring to an SQL database,
that is where your error is probably originating. SQL statements don't
like single quotes, and applications that allow them are prone to SQL
injection attacks..
If you wanted to catch the error manually you should use the 'finally'
statement.

try{
//some code
}
catch{
//some code
}
finally{
if (File.Exists(dosya) == true) { File.Delete(dosya); }
StreamWriter writer = File.CreateText(dosya);
writer.WriteLine(sb.ToString());
writer.Close();
}

Feb 19 '06 #2
butt when I try get error . I am looking step by step.. it comes to
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
And Get response "HTTP 500 INTERNAL ERROR " and goes to CATCH BUT not
goes to under the code. Too
Stream resStream = response.GetResponseStream();

So I don'T get sources code of Site in resStream . :((

Feb 19 '06 #3
HElpp ?? :(

Feb 20 '06 #4
Where is your SQL statement?

The error you are recieving is due to your SQL statement, NOT your
HttpWebResponse statement.

Try googling "Microsoft OLE DB Provider for SQL Server error '80040e14'"

Feb 22 '06 #5
The reason you will be getting the error is because the site is
actually returning a 500 error when you call it with this URL:
site.com/news.asp?id=55a

This is because the parameter ID probably is expecting a numeric value.
55a is not a numeric value.
Probably whats happening on the server end of 'site.com/news.asp' is
that the server side code is collecting the value of ID and casting it
to an integer.
Of course it then throws an exception and dies, probably with a 500
error.

Try pasting your URL "site.com/news.asp?id=55a" into a web browser and
see if you get a Server Error and an equivalent error code of 500.

Essentially the problem is not with your code.

SN

Feb 22 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
1
by: Dirk Försterling | last post by:
Hi, sorry for reposting, but it seems my message just hit nothing but air. If I posted to the wrong list or did something else wrong with the message, please let me know. I really want to...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
33
by: Lalatendu Das | last post by:
Dear friends, I am getting a problem in the code while interacting with a nested Do-while loop It is skipping a scanf () function which it should not. I have written the whole code below. Please...
10
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have...
2
by: david | last post by:
Anyone could give me a hand about this syntax error? Thank you. David Source Code: Dim conn As New SqlConnection(strConn) Dim daAngio As New SqlDataAdapter(strSelectStatement, conn) 'Create a...
4
by: Steve | last post by:
I have read a couple articles online, read my Jesse Liberty book but I am still confused as to just what the best practices are for using exceptions. I keep changing how I'm working with them and...
1
by: liuhaoran | last post by:
HI. i have a question about memory error. when i change double variable to float variable ,for example: int curGen = 0; double sum = 0; // m_iPopSize is int variable ,NewPop is a vector...
4
by: sid | last post by:
"about:blank" oepns new browser window I am writing a webpage that will run on other machines that I may or may not know about. My page is framed where frame1 controls the content of frame2. ...
7
by: EManning | last post by:
Using A2003. I'm receiving this error when returning from a "DoCmd.OpenReport..." statement. I have a tab control with a subform on every tab. The user selects an item from a combobox at the top...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.