Home How to access files within the wwwroot folder of a different project?
Reply: 1

How to access files within the wwwroot folder of a different project?

Ganon
1#
Ganon Published in 2018-01-12 22:44:27Z

I have 2 projects that are needing to talk to one another. The first is a ASP.NET MVC project, that when in production, has a feature where the user can edit an html template that is stored in the wwwroot folder of the project.

The second project is a C# console app that grabs some user data from a database, and then uses that data to email surveys to users. The html template from the first project is needing to be grabbed by this console app so that it can be used in sending out these emails. I was hoping to use HtmlAgilityPack to grab the html email template from the first project when it is live, something along the lines of this:

var web = new HtmlWeb();
var document = web.Load("www.sitename.com/EmailTemplate");
string text = document.ParsedText;

But I'm open to other ideas that might work in this case. More or less I think I just need to figure out how to access static html files from within the wwwroot folder from a browser path, if that's possible. Oh and these two projects are going to be running on different servers, so local paths won't work. Thank you!

Ganon
2#
Ganon Reply to 2018-01-16 00:34:23Z

In large part thanks to ADyson's comments, the course of action that makes most sense in this situation is to create a small API within the MVC app, that fetches the html file, and the console app will call this API to retrieve the needed html.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304465 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO