I'm using a shared host to run a modified version of The Beer House e-commerce module (using www.DiscountASP.NET) However, they (and most shared hosts) don't support Distributed Transaction Processing, which The Beer House uses. So I get this error when trying to submit an order to PayPal:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 658: cmd.Parameters.Add("@Quantity", SqlDbType.Int).Value = orderItem.Quantity;
Line 659: cmd.Parameters.Add("@OrderItemID", SqlDbType.Int).Direction = ParameterDirection.Output;
Line 660: cn.Open();
Line 661: int ret = ExecuteNonQuery(cmd);
Line 662: return (int)cmd.Parameters["@OrderItemID"].Value; |
Source File: e:\web\joleneandaa\htdocs\App_Code\DAL\SqlClient\SqlStoreProvider.cs Line: 660
I got the following message back from my host:
"Due to security concerns, I'm afraid that we will not be able to provide access to the Microsoft Distributed Transaction Coordinator. If your application requires transactions, ASP.NET web transactions are not supported, however, you can use the SQL Transaction class as an alternative as a workaround."
So does anyone know how I would convert to using the SQL Transaction class? Or does anyone know of a host that supports shared Distributed Transaction Processing? I would hate to scrap all of the work I've done.
This is the code that comes up in the debugger:
public override int InsertOrderItem(OrderItemDetails orderItem)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("tbh_Store_InsertOrderItem", cn);
cmd.CommandType =
CommandType.StoredProcedure;cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = orderItem.AddedDate;
cmd.Parameters.Add(
"@AddedBy", SqlDbType.NVarChar).Value = orderItem.AddedBy;cmd.Parameters.Add("@OrderID", SqlDbType.Int).Value = orderItem.OrderID;
cmd.Parameters.Add(
"@ProductID", SqlDbType.Int).Value = orderItem.ProductID;cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = orderItem.Title;
cmd.Parameters.Add(
"@SKU", SqlDbType.NVarChar).Value = orderItem.SKU;cmd.Parameters.Add("@UnitPrice", SqlDbType.Money).Value = orderItem.UnitPrice;
cmd.Parameters.Add(
"@Quantity", SqlDbType.Int).Value = orderItem.Quantity;cmd.Parameters.Add("@OrderItemID", SqlDbType.Int).Direction = ParameterDirection.Output;
cn.Open(); //This is where the error occurs
int ret = ExecuteNonQuery(cmd);return (int)cmd.Parameters["@OrderItemID"].Value;
}
}
Thanks!