Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. System.ArgumentNullException: Value cannot be null. [modified]

System.ArgumentNullException: Value cannot be null. [modified]

Scheduled Pinned Locked Moved ASP.NET
helpdesign
4 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kmsandeep
    wrote on last edited by
    #1

    my project is running locally fine. But when i upload it shows below error [ArgumentNullException: Value cannot be null. Parameter name: type] System.Activator.CreateInstance(Type type, Boolean nonPublic) +7465206 System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +79 System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +231 System.Web.HttpContext.get_Profile() +107 ProductsAccordingCat.get_Profile() +49 ProductsAccordingCat.gotoCart(Object sender, EventArgs e) in ProductsAccordingCat.aspx.cs:696 System.Web.UI.ImageClickEventHandler.Invoke(Object sender, ImageClickEventArgs e) +0 System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108 System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118 System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 Please help me to solve this problem. below is code protected void gotoCart(object sender, EventArgs e) { ImageButton btn = (ImageButton)sender; double Price = double.Parse(((Label)btn.Parent.FindControl("Price")).Text);//.Substring(8)); string ProductName = ((HyperLink)btn.Parent.FindControl("hlnkProductName")).Text; string ImagePath = ((System.Web.UI.WebControls.Image)btn.Parent.FindControl("imgProduct")).ImageUrl; string ProductID1 = ((HtmlInputHidden)btn.Parent.FindControl("hdnid")).Value; string ParentID = ((HtmlInputHidden)btn.Parent.FindControl("hdnParentID")).Value; int ProductID = Convert.ToInt32(ProductID1.Substring(1)); if (Profile.Cart == null) // here at this line it shows error { Profile.Cart = new shopping.ShoppingCart(); } Profile.Cart.Insert(ProductID, Price,0, 1, ProductName, ImagePath); Response.Redirect(ResolveUrl("~") + "Shopping_Cart/ShoppingCart.aspx"); }

    modified on Tuesday, September 22, 2009 12:52 PM

    E 1 Reply Last reply
    0
    • K kmsandeep

      my project is running locally fine. But when i upload it shows below error [ArgumentNullException: Value cannot be null. Parameter name: type] System.Activator.CreateInstance(Type type, Boolean nonPublic) +7465206 System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +79 System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +231 System.Web.HttpContext.get_Profile() +107 ProductsAccordingCat.get_Profile() +49 ProductsAccordingCat.gotoCart(Object sender, EventArgs e) in ProductsAccordingCat.aspx.cs:696 System.Web.UI.ImageClickEventHandler.Invoke(Object sender, ImageClickEventArgs e) +0 System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108 System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118 System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 Please help me to solve this problem. below is code protected void gotoCart(object sender, EventArgs e) { ImageButton btn = (ImageButton)sender; double Price = double.Parse(((Label)btn.Parent.FindControl("Price")).Text);//.Substring(8)); string ProductName = ((HyperLink)btn.Parent.FindControl("hlnkProductName")).Text; string ImagePath = ((System.Web.UI.WebControls.Image)btn.Parent.FindControl("imgProduct")).ImageUrl; string ProductID1 = ((HtmlInputHidden)btn.Parent.FindControl("hdnid")).Value; string ParentID = ((HtmlInputHidden)btn.Parent.FindControl("hdnParentID")).Value; int ProductID = Convert.ToInt32(ProductID1.Substring(1)); if (Profile.Cart == null) // here at this line it shows error { Profile.Cart = new shopping.ShoppingCart(); } Profile.Cart.Insert(ProductID, Price,0, 1, ProductName, ImagePath); Response.Redirect(ResolveUrl("~") + "Shopping_Cart/ShoppingCart.aspx"); }

      modified on Tuesday, September 22, 2009 12:52 PM

      E Offline
      E Offline
      Expert Coming
      wrote on last edited by
      #2

      Can you show us the code where it is breaking down? The stack helps, but not that much.

      The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

      K 1 Reply Last reply
      0
      • E Expert Coming

        Can you show us the code where it is breaking down? The stack helps, but not that much.

        The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

        K Offline
        K Offline
        kmsandeep
        wrote on last edited by
        #3

        below is code protected void gotoCart(object sender, EventArgs e) { ImageButton btn = (ImageButton)sender; double Price = double.Parse(((Label)btn.Parent.FindControl("Price")).Text);//.Substring(8)); string ProductName = ((HyperLink)btn.Parent.FindControl("hlnkProductName")).Text; string ImagePath = ((System.Web.UI.WebControls.Image)btn.Parent.FindControl("imgProduct")).ImageUrl; string ProductID1 = ((HtmlInputHidden)btn.Parent.FindControl("hdnid")).Value; string ParentID = ((HtmlInputHidden)btn.Parent.FindControl("hdnParentID")).Value; int ProductID = Convert.ToInt32(ProductID1.Substring(1)); if (Profile.Cart == null) // here at this line it shows error { Profile.Cart = new shopping.ShoppingCart(); } Profile.Cart.Insert(ProductID, Price,0, 1, ProductName, ImagePath); Response.Redirect(ResolveUrl("~") + "Shopping_Cart/ShoppingCart.aspx"); }

        R 1 Reply Last reply
        0
        • K kmsandeep

          below is code protected void gotoCart(object sender, EventArgs e) { ImageButton btn = (ImageButton)sender; double Price = double.Parse(((Label)btn.Parent.FindControl("Price")).Text);//.Substring(8)); string ProductName = ((HyperLink)btn.Parent.FindControl("hlnkProductName")).Text; string ImagePath = ((System.Web.UI.WebControls.Image)btn.Parent.FindControl("imgProduct")).ImageUrl; string ProductID1 = ((HtmlInputHidden)btn.Parent.FindControl("hdnid")).Value; string ParentID = ((HtmlInputHidden)btn.Parent.FindControl("hdnParentID")).Value; int ProductID = Convert.ToInt32(ProductID1.Substring(1)); if (Profile.Cart == null) // here at this line it shows error { Profile.Cart = new shopping.ShoppingCart(); } Profile.Cart.Insert(ProductID, Price,0, 1, ProductName, ImagePath); Response.Redirect(ResolveUrl("~") + "Shopping_Cart/ShoppingCart.aspx"); }

          R Offline
          R Offline
          Ram Cronus
          wrote on last edited by
          #4

          I would be interested to know if you ever found a solution. I too have recently come across this very same issue when trying to access the Profile object. I dont think it is related to this article some configuration issue on the server - look up MOSS and profile null.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups