0

Here is the code I wrote.

  if (propertyModel.PropertyName.Replace(" ", "") != model.PropertyName.Replace(" ", "") && propertyModel.PropertyRegistrationCompletedPercentage >= 71)
                    {
                        var originalDirectory = new DirectoryInfo(string.Format("{0}Images\\ProprtyImages", Server.MapPath(@"\")));
                        string pathString = System.IO.Path.Combine(originalDirectory.ToString(), propertyModel.PropertyName.Replace(" ", "") + "__" + User.Identity.GetUserId().Replace("-", "") + "__" + "propertyid" + "__" + propertyModel.PropertyId.ToString());
                        string newpathstring = System.IO.Path.Combine(originalDirectory.ToString(), model.PropertyName.Replace(" ", "") + "__" + User.Identity.GetUserId().Replace("-", "") + "__" + "propertyid" + "__" + propertyModel.PropertyId.ToString());
                        bool isExists = System.IO.Directory.Exists(pathString);
                        if (isExists)
                        {
                            Directory.Move(pathString, newpathstring);
                        }
                        else
                        {
                            ViewBag.Message = "Unexpected IO error occurred.";
                            return View("ErrorPageWithCustomMessage");
                        }
                    }
                    Session["PropertyRegistrationCompletedPercentage"] = propertyModel.PropertyRegistrationCompletedPercentage;
                    Session["IsPropertyBeingStartedToAdd"] = propertyModel.IsPropertyBeingStartedToAdd;
                    Session["IsPropertyAddingCompleted"] = propertyModel.IsPropertyAddingCompleted;
                    Session["IsThePropertyVerified"] = propertyModel.IsThePropertyVerified;

When I try to retrieve session variable after redirecting in to an another action those values are gone how to fix this?

user3762230
  • 43
  • 2
  • 11

0 Answers0