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 5962457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:06:29+00:00 2026-05-22T19:06:29+00:00

This workflow is a xamlx file in an asp.net application. I have a CodeActivity

  • 0

This workflow is a xamlx file in an asp.net application.

I have a CodeActivity with an InArgument that takes a relative file path to a text file that lives in the asp.net application.

What is the right way to turn the relative path into an absolute path, so that I can read the file into memory.

HttpContext.Current is null in the code activity so I can’t use Server.MapPath.

The way I have it working now is by reading an appsetting called SitePhysicalRoot from web.config and passing the SitePhysicalRoot setting and the inargument value to Path.Combine.

I feel like there is a better way to do this (maybe with a WF extension). If a WF extension is the way to go, can someone provide sample code?

  • 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-22T19:06:30+00:00Added an answer on May 22, 2026 at 7:06 pm

    This is what I do:

    using System;
    using System.Diagnostics.Contracts;
    using System.IO;
    using System.Web.Hosting;
    
    public static class PathExtensions
    {
        public static String ExpandPath(this String path)
        {
            if (String.IsNullOrWhiteSpace(path))
            {
                return path;
            }
    
            String resolvedPath = Environment.ExpandEnvironmentVariables(path);
    
            resolvedPath = ExpandHostedPath(resolvedPath);
    
            return resolvedPath.ToFullPath();
        }
    
        public static String ToFullPath(this String path)
        {
            Contract.Requires<ArgumentNullException>(String.IsNullOrWhiteSpace(path) == false);
    
            DirectoryInfo directory = new DirectoryInfo(path);
    
            if (directory.Exists)
            {
                return directory.FullName;
            }
    
            return path;
        }
    
        private static String ExpandHostedPath(String path)
        {
            if (Path.IsPathRooted(path))
            {
                return path;
            }
    
            if (path.StartsWith("~", StringComparison.OrdinalIgnoreCase) == false)
            {
                return path;
            }
    
            if (HostingEnvironment.IsHosted == false)
            {
                return path;
            }
    
            String hostedPath = HostingEnvironment.MapPath(path);
    
            return hostedPath;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two process and a shared memory zone, my workflow is like this.
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit
I'm creating an application that rehost the workflow designer and that can load an
I am developing a WF4 application. The workflows are hosted in an ASP.NET website.
I have a custom workflow that uses the Collect data from a user action,
The workflow is like this: I receive a scan of a coupon with data
so I have this requirement to kick off Activities provided to me at run-time.
This is proof of concept project - The goal is to create an application
Folks, I'm building a pretty standard workflow that I want exposed via a WCF
Current Python Workflow I have pip , distribute , virtualenv , and virtualenvwrapper installed

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.