473,219 Members | 1,670 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,219 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 1112
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...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.