Nothing
Nothing

Reputation: 2642

System.Web.HttpException: <html path> is not a valid virtual path

I try lots of solution that solve by others, but it still got this error:

'http:/gg:9090/Product/HtmlDetail/test.htm' is not a valid virtual path. I want to print the content of test.htm text into my div block. This is my code:

<% Response.WriteFile("http://gg:9090/Product/HtmlDetail/test.htm"); %>

Upvotes: 0

Views: 3664

Answers (1)

Karthik
Karthik

Reputation: 2399

try this

<% Response.WriteFile("~/HtmlDetail/test.htm"); %>

EDIT:

in codebehind:

WebClient client = new WebClient();
Stream stream = client.OpenRead("http://gg:9090/Product/HtmlDetail/test.htm");
StreamReader sr = new StreamReader(stream);
string content = sr.ReadToEnd();
div1.InnerHtml = content;

in aspx page:

<div id="div1" runat="server"></div>

Upvotes: 1

Related Questions