-2

I would like to know if there is an elegant way to pass the whole HTML code of the current screen to ASP.NET Controller action

Davit Karapetyan
  • 589
  • 1
  • 6
  • 14
  • 2
    Why do you want to do that? And if someone says "yes, there is", then what's your next question? – mason Feb 07 '18 at 01:05

1 Answers1

1

Just for fun, and since I wanted to try SO run snippets :), this trivial sample may get you started.

function foo() {
  var ele = document.getElementById("result");
  var html = document.documentElement.innerHTML;
  ele.innerText = html;
}
<button type="button" onclick="foo()">Try Me</button>
<p>
  <textarea id="result" cols="80" rows="10"></textarea>
</p>
  • Now you have your "HTML source" text, well, except for the top level html element.
  • You can do whatever you want to POST it somewhere, however you choose, which I'll leave up to you to handle :)

Fun times ~

EdSF
  • 11,753
  • 6
  • 42
  • 83