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

  • SEARCH
  • Home
  • 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 4586902
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:42:16+00:00 2026-05-21T21:42:16+00:00

First I’ll explain the project structure: Solution Templates Sport Sport.doc Opendoc.aspx Opendoc.aspx.cs Now the

  • 0

First I’ll explain the project structure:

  • Solution
    • Templates
      • Sport
        • Sport.doc
  • Opendoc.aspx
    • Opendoc.aspx.cs

Now the problem.
In the Opendoc.aspx.cs I’m trying to open Sport.doc but that isn’t working when i’m using a relative path. only when I hard code it like c://Sport.doc.

After I click on a button on that page I go to this method:

protected void btnCreateWordBulletin_Click(object sender, EventArgs e)
{
    string path = VirtualPathUtility.ToAbsolute("~/Sport/Sport.doc");
    string Savepath = VirtualPathUtility.ToAbsolute("~/Sport/SportEvent.doc");
    CreateWordDocument(path, Savepath );
}

protected void CreateWordDocument(object fileName, object saveAs)
{
    //Set Missing Value parameter - used to represent
    //a missing value when calling methods through interop
    object missing = System.Reflection.Missing.Value;

    //Setup the Word.App class
    Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
    Microsoft.Office.Interop.Word.Document aDoc = null;
    // Check to see that file exists
    if (System.IO.File.Exists((string)fileName))
    {... Activating doc etc...}}

But the System.IO.File.exists doesn’t seem to find the document.

I tried using .//Sport/sport.doc , ../Sport.doc, .//Template/Sport/sport.doc, ..//Template/Sport.doc.

  • 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-05-21T21:42:16+00:00Added an answer on May 21, 2026 at 9:42 pm

    Try

    HttpApplication.Server.MapPath("/Solution/Templates/Sport/Sport.doc");
    

    Thanks!
    Also please comment if it doesn’t work.

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

Sidebar

Related Questions

First of all, i would like to explain my condition right now. I'm using
First post, but I've been lurking around this site for a long while now,
First of all, my table structure is something similar like this: CREATE TABLE Testing(
First some background. I inherited a project where the build file was already written
First of all, some background: I'm trying to get in a list of integers
First, I am a SQL noob, second if there is a better solution that
First of all, i am not trying to hack into anything or anyones e
First posting to Stackoverflow, but have been searching for answers for sometime now. Learning
first question from newbie. Haven't needed to post a question for months now --
First off...here's the problem... Give an example of a directed graph G = (V,

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.