PDA

View Full Version : Problem with System.Transactions


Mauricio
09-04-2007, 05:30 PM
Hello,

I'm implementing an online store and I have a problem with the following code:

[......]

public void SaveOrder(int orderID)
{
using (TransactionScope scope = new TransactionScope())
{
foreach (ShoppingCartItem product in this.Items)
{
product.OrderID = orderID;
SiteProvider.Store.InsertOrderItem(product);
}
}
}

[......]
Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Transactions.DistributedTransactionPermiss ion, System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


This problem occurs before you submit an order for checkout.

Link: http://webstore.dotnetglobalservices.com/

Please give me any suggestions.

Regards,
Mauricio

Carl Shepherdson
09-04-2007, 09:41 PM
What trust level did you develop it in?

We run Medium Trust across all web servers.

Ben Collier
09-04-2007, 10:54 PM
Could you possibly post up the entire page? I think it might be the way you are trying to access the sql server. I personally use VB but will give it a go?

Ben

p.s. edit out any passwords!

Ben Collier
09-04-2007, 10:55 PM
Also have you developed this yourself? and how experienced with asp.net are you? Just so I don't be too technical or patronising!!

Ben

Mauricio
09-04-2007, 11:31 PM
I've just fixed this.

TransactionScope requires FullTrust permission.
I've replaced it with an alternative code.

Thanks

Ben Collier
09-04-2007, 11:57 PM
Thought it'd be something like that!
Glad you've got it working!
Ben