Title: ASPX Seite als HTML-Mail Body

Hi,
ich m�chte f�r eine HTML-Mail eine ASPX Seite versenden. In der MSDN hab ich folgendes Beispiel gefunden um den HTML Output einer Seite in einen StringWriter zu schreiben.

The following example executes the aspx page "Login.aspx" on the server in the current directory and receives the output from the page through the StringWriter object writer. It writes the HTML stream received from writer to the HTTP output stream.

 Note This example shows how to use one of the overloaded versions of Execute. For other examples that might be available, see the individual overload topics.

StringWriter writer = new StringWriter();
Server.Execute("Login.aspx", writer);
Response.Write("<H3>Please Login:</H3><br>"+ writer.ToString());

Was ich denke was das Beispiel machen soll.
1. Es wird ein StringWriter erstellt.
2. Mittels Server.Execute wird die Login.aspx ausgef�hrt und der Output in den StringWriter geschrieben.
3. Mittels Response.Write wird der Output des Server.Execute ausgegeben.

Also hab ich jetzt folgenden Code erstellt.
System.IO.StringWriter TxtWrit = new System.IO.StringWriter();
Server.Execute("/myPage.aspx",TxtWrit);

Eigentlich sollte jetzt der HTML Output der ausgef�hrten Seite im TextWriter stehen, aber ich bekomme nur folgenden Fehler:

The View State is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The View State is invalid for this page and might be corrupted.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:

 [HttpException (0x80004005): The View State is invalid for this page and might be corrupted.]    System.Web.UI.Page.LoadPageStateFromPersistenceMedium()    System.Web.UI.Page.LoadPageViewState()    System.Web.UI.Page.ProcessRequestMain() 

W�re auch f�r eine andere L�sung meines Problems offen.

Gruss Thomas

| [aspdedotnet] als [email protected] subscribed | http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv | Sie k�nnen sich unter folgender URL an- und abmelden: | http://www.dotnetgerman.com/listen/aspDEdotnet.asp

Antwort per Email an