Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
integration:foxycart:datafeed_with_csharp [2012/08/15 10:05] – [Requirements] 95.144.180.128 | integration:foxycart:datafeed_with_csharp [2019/10/31 21:34] (current) – [Code] marija | ||
---|---|---|---|
Line 1: | Line 1: | ||
---- dataentry integration ---- | ---- dataentry integration ---- | ||
- | type : integration | + | type |
- | supports-foxycart-version-from : | + | supports-foxycart-version-from : # Minimum required FoxyCart version for this to work |
- | supports-foxycart-version-to | + | supports-foxycart-version-to |
- | systems | + | systems |
- | name : ASP.NET C\# API + Datafeed Code | + | name |
- | description | + | description |
- | tags_tags | + | tags : api, datafeed, xml, c\#, csharp, integration # tags, separated by commas. don't include the " |
- | date_dt | + | date_dt |
- | version | + | version |
- | developer_url : | + | developer_url |
---- | ---- | ||
- | ====== ASP.NET with C\# XML Datafeed E-Commerce Integration ====== | + | |
+ | ====== ASP.NET with C# XML Datafeed E-Commerce Integration ====== | ||
<WRAP important round> | <WRAP important round> | ||
Line 43: | Line 44: | ||
public partial class ProcessTransaction : System.Web.UI.Page | public partial class ProcessTransaction : System.Web.UI.Page | ||
{ | { | ||
- | private string API_KEY = "Your FoxyCart API Key"; | + | private string API_KEY = "Your FoxyCart |
| | ||
protected void Page_Load(object sender, EventArgs e) | protected void Page_Load(object sender, EventArgs e) | ||
Line 49: | Line 50: | ||
try | try | ||
{ | { | ||
- | | + | |
- | | + | |
- | | + | var ffBytes = Encoding.UTF8.GetBytes(foxyFeed); |
- | | + | |
- | + | var unencodedFeed = HttpUtility.UrlDecode(ffBytes, | |
- | //Process | + | |
+ | //At this point, we've decrypted UTF-8 data using the Latin-1 encoding, which functions properly, unless there are special characters in your data. | ||
+ | // | ||
+ | //In order to fix the special characters, you need to turn the string back into Latin-1 bytes, and convert it to a UTF-8 string. | ||
+ | var transaction = Encoding.UTF8.GetString(Encoding.GetEncoding(1252).GetBytes(decryptedTransaction)); | ||
+ | | ||
+ | //Now you can process | ||
+ | | ||
Response.Write(" | Response.Write(" | ||
} | } | ||
catch (Exception) { } // | catch (Exception) { } // | ||
} | } | ||
- | |||
/** | /** |