Exception from Response.Redirect?
Posted
by
allencoded
on Stack Overflow
See other posts from Stack Overflow
or by allencoded
Published on 2012-06-27T15:12:12Z
Indexed on
2012/06/27
15:15 UTC
Read the original article
Hit count: 179
I keep getting an error:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code The thread '' (0x27ee4) has exited with code 0 (0x0).
I was told it was related to this:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Results.aspx?Keywords=" + searchString.Text);
}
I figured it may help to include my complete code. The code above is the only C# code on my first asp page.
That code relates to this code on this page. It is also the only C# code I have on my second page. I am simply just trying to pass a keyword from a search form to this block of code:
if (Request.QueryString["Keywords"] != null){
string keywords = Request.QueryString["Keywords"];
string myAppID = "HIDDEN";
var xml = XDocument.Load("http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=" + myAppID + "&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=" + keywords + "&paginationInput.entriesPerPage=5");
XNamespace ns = "http://www.ebay.com/marketplace/search/v1/services";
var titles = from item in xml.Root.Descendants(ns + "title")
select new{
title = xml.Descendants(ns + "title").Select (x => x.Value),
};
foreach (var item in titles){
Label1.Text += item;
}
}
This block of code calls the keyword value and uses it in an api to perform a search. The code of the xml(api) formats like this:
<findItemsByKeywordsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services">
<searchReslut count="5">
<item>
<title></title>
</item>
<item>
<title></title>
</item>
<item>
<title></title>
</item>
Why am I getting this error how do you fix it?
© Stack Overflow or respective owner