Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on [email protected] for help. Thanks :)
Hello All, This is just a friendly reminder to read the Forum Charter where you wish to post before posting in it. :)
Hi all, The AutoSave Draft feature is now disabled across the site. The decision to disable the feature was made via a poll last year. The delay in putting it in place was due to a bug/update issue. This should serve as a reminder to manually save your drafts if you wish to keep them. Thanks, The Boards Team.

C# shopping basket, trying to remove an item...

1234568

Comments

  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    You'd think I've have remembered that!!!!! :D:D:D


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    I don't know whether to laugh or cry!!! It's finally working...

    But when I upload it to my Web Server, I get the same error I had a week or two ago when I was still using MSVDE 2005...

    Server Error in '/' Application.
    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

    Source Error:

    Line 25: <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    Line 26: <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
    Line 27: <authentication mode="Windows"/>
    Line 28: <pages>
    Line 29: <controls>




    Last week I called my hosting company and asked them was my package 3.5 .net enabled and he said it was... Although when I log into my Admin panel, there are only two options, asp version 1 or 2... This is working grand on my local dev server so I'm assuming the fact that I can't run the solution on my web server is down to a hosting issue???


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    have you more than one site that is using .net on this package? Sounds like you have a top sit created a new folder below it and popped this new solution in that folder. Its this second web.config is causing the problem as its not allowed


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    have you more than one site that is using .net on this package? Sounds like you have a top sit created a new folder below it and popped this new solution in that folder. Its this second web.config is causing the problem as its not allowed

    Yeah I've a few sites on the same package and they are running asp.net. I'll get onto the hosting co in the morning and see what they say. I always assumed each site was independent of other sites on the same hosting package...


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    they are provided you have them in seperate folders. If you have this solution in a sub folder of an existing asp.net site you will get this error


  • Advertisement
  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    they are provided you have them in seperate folders. If you have this solution in a sub folder of an existing asp.net site you will get this error

    I just had a think about this... I've a few other sites running on this hosting package but they all have their own web.config file and they've all been working away grand before I tried to upload this solution. I think I uploaded it wrong, because this approach of uploading a solution with different projects and folders is new to me. Previously I just uploaded a load of files that sat in the wwwroot folder and all worked fine.

    After I upload the solution, I should refer to the Catalog.aspx file as www.mydomain.ie/ShoppingCartDemo/Catalog.aspx? The way I've done this up until now has been just upload the files and then view it by vieiwing www.mydomain.ie/Default.aspx or whatever the name of the page may be... Just wondering is there any rules I need to be aware of when uploading a solution like this with different projects and subfolders???


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    What I mean to ask is if I uploaded this correctly, should I be using the URL www.mydomain.ie/Catalog.aspx or should I be using the URL www.mydomain.ie/ShoppingCartDemo/Catalog.aspx???


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    First 1

    You shouldnt have the shoppingcartdemo in the name at all

    The problem is where the folder is sitting etc.

    Its basically an issue of how you publish it


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    I see what you mean, I sorted that out so now I don't have the ShoppingCartDemo sub directory there. I got onto my hosting co as they reckon they have to make some changes to my hosting package to get this working, something to do with trust level settings...


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    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: That assembly does not allow partially trusted callers.

    Source Error:

    [No relevant source lines]


    Source File: App_Web_wdiltxyx.2.cs Line: 0

    Stack Trace:

    [SecurityException: That assembly does not allow partially trusted callers.]
    ASP.catalog_aspx..ctor() in App_Web_wdiltxyx.2.cs:0
    __ASP.FastObjectFactory_app_web_wdiltxyx.Create_ASP_catalog_aspx() in App_Web_wdiltxyx.7.cs:0
    System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
    System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
    System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
    System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
    System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
    System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

    Just wondering could I change the trust level in my config.web file to resolve this?


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Make sure all the assemblies are strongly named.

    If you downloaded a version of my projects other the first one, it would have asked for a password when you ran it first.

    Check the project properties of each project and verify that they are being signed


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Also possible you could add

    <trust level="Full"> in the system.web part of your web.config


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    I tried the <trust level="Full"> and I get this:

    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

    Source Error:

    Line 15:
    Line 16: <customErrors mode="Off"/>
    Line 17: <trust level="Full" />
    Line 18: <compilation debug="true">
    Line 19: <assemblies>


    When I got this I got onto my hosting co and they said they need to do a bit of rummaging around with my hosting package to get it working...


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Take it out for the moment.

    Verify that your virtual directories are not on networked drives as they may be causing an issue


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    Take it out for the moment.

    Verify that your virtual directories are not on networked drives as they may be causing an issue

    It just goes back to the previous error when I take <trust level="Full"> out of the config file...

    Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers, blah blah blah...


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Understandable but it sounds like a config error somewhere on the host but I cant say much more than that...


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    Understandable but it sounds like a config error somewhere on the host but I cant say much more than that...

    Just off the phone to the hosting co again, they are certain now that it's an issue with the site configuration at their end. They'll have it sorted in a few minutes hopefully. They have Trust levels set that I can't override through the config file so they have to kind of change privileges for my site so I can set trust levels for my own site...


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Cool..

    Hopefully this will all work in the end


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    Cool..

    Hopefully this will all work in the end

    Happy days, its working now!


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    RIght then .. interesting project.. hope you learned some stuff from it..

    Best of luck in the rest of it


  • Advertisement
  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    RIght then .. interesting project.. hope you learned some stuff from it..

    Best of luck in the rest of it

    I want to get on top of this "Data Access Layer" and "Business Logic Layer", use methods and that stuff... It's starting to make sense, now that it works and runs remotely I can fiddle around with it and see how the different layers interact with each other... Thanks so much for your help and patience with it!


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Just an FYI updated the version of this with a blog post etc..


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    I tried today to change the data type of the Cost from int to float and did the following:

    (1) I changed the column type in the DB

    (2) I made a change in the Product.cs file to change declare Cost as a float intead of an int.

    (3) I made a change in the CartItem.cs file to change TotalPrice from an int to a float.

    (4) In the Catalog.aspx.cs file I changed _totalprice from an int to a float.

    I've rummaged around within the solution for any other declaration of variables that I thought could be causing the attached error but I can't find any... :confused::confused::confused:

    I'm just checking out your blog here...


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Change it to double in both database and code..


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    Change it to double in both database and code..

    I just tried to do it in my DB but "double" isn't an option when I try to modify the column... The only two data types starting with d are "decimal" and "datatype"...


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Oki doki

    Just had a quick look at http://msdn.microsoft.com/en-us/library/ms131092.aspx

    SQL float == .NET double

    so change the code to double and it shoudl be fine.. leave the database at float


  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    If that doesnt work, I will have to work out some form of conversion


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    Ginger wrote: »
    Oki doki

    Just had a quick look at http://msdn.microsoft.com/en-us/library/ms131092.aspx

    SQL float == .NET double

    so change the code to double and it shoudl be fine.. leave the database at float

    That sorted it out Ginger, thanks agan...


  • Closed Accounts Posts: 7,097 ✭✭✭ Darragh29


    I'm fiddling around with this at the minute and am trying to add a bit onto the solution by uploading an image into my Product DB table and then getting the thumbnail image to display in my Catalog with the other variables, I'm just trying to get an image to show up on the catalog for any given DB record that might be returned based on a dropdown selection, and then if the thumbnail is clicked, I want a larger sized image to be returned.

    What I'd like to have is for a thumbnail image to come up automatically in the Catalog and then if this thumbnail is clicked, a full sized image to appear.

    I've added two new variables of type bool and varchar named Image_Data and Image_Name respectively to the Product.cs file in Entities and I've also ammended my DB to have two new columns for my image data and image name...

    After that, is it just a matter of setting up a ImageButton in my aspx page???

    Like this:

    <td><asp:LinkButton ID="_ViewImage" CommandArgument="<%# ((Product)Container.DataItem).Image_Name %>" CommandName="ViewImage" runat="server" Text="Image" /> </td>


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭ Ginger


    Sorry mate was meant to come back to this

    It doesnt need to be that complex..

    You can use a simple <a href="ViewLargeImage.aspx?=<%# ((Product)Container.DataItem).Image_Id %>"><img src="image"></a>

    You should use a bool, and an id, and path to the image (or if you are storing the image in the database, use a bytes[] )


Advertisement