i am trying to use this code:
<%= File.ReadAllText(Server.MapPath("Members/newsletters/welcome.html"))%>
which works great but now the welcome.html file has moved onto another server so i need to read it from an external URL .
any suggestions?
i am trying to use this code:
<%= File.ReadAllText(Server.MapPath("Members/newsletters/welcome.html"))%>
which works great but now the welcome.html file has moved onto another server so i need to read it from an external URL .
any suggestions?
Have a look at the HttpWebRequest class in .NET (there's an example at that URL or have a look at this blog).
You need to be more specific. Are you trying to read it from an UNC path or over the web? Is the other on your network?
If UNC path, probably easiest to map a drive on your local server so it looks like a local file.
Of course, I'm wondering why you're doing it this way at all. Why not replicate the content to all web servers? Reading over network is expensive. Also, that logic should probably be encapsulated in a helper method which can handle caching. You might consider moving the logic to retrieve that content to your controller. A view should render the model data given to it.