0

I am facing a problem while working with xml file in asp.net mvc 5. I need to load a xml file. and read the xml data in different views. which have individual controller too. I have loaded the xml file successfully. But I can not catch the idea how can I pass the xml file data to other controller. Like I have a Controller for loading the xml file. And I have another controller to read the xml data. Can you guys give me the idea how to do the rest work?

1
  • You can always serialize the XML to an object and save it to Cache or a Session variable. Or you can make a base controller and make sure that all of your project controls inherit from it. Inside the base controller, place all of your code for handling the XML in it on the "ActionExecuting" function. Commented Sep 21, 2016 at 15:16

1 Answer 1

1

Sorry for my late answer. The problem was that I did not get full directory path to read the file. Then I created a cache memory to save the file and read it. And to read data in several controller I used like, Session["abc"] = "asas"; And to get this information in other controller, Viewbag.abc = Session["abc"];

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.