1

I have c# web application project in which i want to install user uploaded .ttf font files into system.

I am using FontReg for the same. We can execute by using command line parameters as D:\TFS\Dev\Sprint_18_III\UI\Web\FontFiles>FontReg /copy so it will install all .ttf files present in directory

same this i am trying to achieve in c# code

using (Process process = new Process())
            {
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.Verb = "runas";
                startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.FileName = "D:\\TFS\\Dev\\Sprint_18_III\\UI\\Web\\FontFiles\\FontReg.exe"; 
                startInfo.Arguments = "/copy";
                process.StartInfo = startInfo;
                process.Start();
                process.WaitForExit();
            }

Process gets completed but font doesn't install. What i am missing here ?

  • I dont want to give admin rights to entire web application running. It should be specific to one method only.
8
  • Is the working directory D: the directory you want it to search for fonts? Commented Dec 17, 2015 at 16:00
  • 1
    Are you trying to add the font's on the client or the server? Commented Dec 17, 2015 at 16:01
  • 4
    Installing a font on a server does not really help a client, unless you are doing some kind of remote desktop. Commented Dec 17, 2015 at 16:18
  • 1
    Does the process completed with or without error (check Process.ExitCode)? Because I'm pretty much sure installing a font requires elevated permission, which normal web application running under restricted account does not have Commented Dec 17, 2015 at 16:18
  • 1
    You don't need the space in startInfo.Arguments. Commented Dec 17, 2015 at 16:47

1 Answer 1

1

I believe that you are running the program with a under-privileged user... the IIS user, by default is "Network Authority", and this account cannot perform changes in the windows directory... try running this with a admin account...

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.