Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:59:46+00:00 2026-06-09T12:59:46+00:00

I am trying to read an MS Project File using the .net version of

  • 0

I am trying to read an MS Project File using the .net version of MPJX in C# MVC3.
I am using jQuery uploadify to upload the file to my controller.

Now, my problem is how to read the ProjectFile from my HttpPostedFileBase file = Request.Files[0]; I am getting an exception when reading the file because file.FileName doesn’t contain the file’s full path as part of browser security. If only I was good or at least have knowledge in java then I’d just convert the posted file to java.io.file as it’s one of the valid parameters that ProjectReader.read supports.

Below is a code snippet of what I have right now (got the codes from the thread in Example of MPXJ library in C#).

 [HttpPost]
 public JsonResult UploadTask(int ProjectType)
    {
        try
        {
            HttpPostedFileBase file = Request.Files[0];
            MpxjReader.ProjectReader mppReader = MpxjReader.ProjectReaderUtility.getProjectReader(file.FileName);
            Mpxj.ProjectFile mpp = mppReader.read(file.FileName);

            List tables = mpp.getTables();
            Iterator iter = tables.iterator();
            while (iter.hasNext())
            {
                MpxjCore.Table table = (MpxjCore.Table)iter.next();
                if (table.getResourceFlag())
                {
                    List resources = mpp.getAllResources();
                    Iterator resourceIter = resources.iterator();
                    while (resourceIter.hasNext())
                    {
                        MpxjCore.Resource resource = (MpxjCore.Resource)iter.next();
                        List columns = table.getColumns();
                        Iterator columnIter = columns.iterator();
                        while (columnIter.hasNext())
                        {
                            MpxjCore.Column column = (MpxjCore.Column)columnIter.next();
                            Object columnValue = resource.getCachedValue(column.getFieldType());
                            Console.Write(columnValue);
                            Console.Write(",");
                        }
                        Console.WriteLine();
                    }
                }
                else
                {
                    List tasks = mpp.getAllTasks();
                    // etc. as above
                }
            }

            return Json(new { data = "success" }, JsonRequestBehavior.AllowGet);
        }
        catch
        {
            return Json(new { data = "error" }, JsonRequestBehavior.AllowGet);
        }
    }

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:59:47+00:00Added an answer on June 9, 2026 at 12:59 pm

    UPDATE: I’VE ALREADY SOLVED THE ISSUE BY SAVING THE .MPP FILE TO A SPECIFIED DIRECTORY FIRST THEN READ FROM THAT DIRECTORY (THIS IS HOW IT SHOULD BEHAVE WHEN DEPLOYED IN THE SERVER).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to read a file in my maven project at /src/main/resources/file.txt. I'm using
I trying to upload a zip file. In my project i am using DWR
I am trying to load a Silverlight project to read every XAML file by
i am trying to read a html file and convert it to pdf using
I'm trying to read data from 1.txt in my iphone project's resources folder using
I'm working with Spring/Hibernet using NetBeans 6.9.1. I'm trying to read an Excel file
I'm trying to digitally sign a PDF file using THIS project as an example.
There's a sample ASP.NET project with this controller: using System; using System.Collections.Generic; using System.Web;
I am trying to read a file line by line using the code below
I'm trying to read a long type from a text file using Scanner in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.