Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > running webform page inside MVC framework

Reply
Thread Tools

running webform page inside MVC framework

 
 
Guoqi Zheng
Guest
Posts: n/a
 
      06-07-2009
I am pretty new to ASP.NET MVC. We have a CMS built in MVC. Is it possible
to run webform aspx page or user control inside MVC view or masterpage?

I am thinking as below.

1. In the webform ASPX or user control, I did not include html header, only
a form and basic table or div to make it possible to be inserted into other
page.

2. In the MVC view, I use Server.Execute("webform1.aspx",true); This will
execute the webform, and also pass all parameters to it.

3. In the "webform1.aspx", I rewrite the render event to change <form
action="webform1.aspx"> to <form action="">. This will make the form
submitted to current MVC route instead of the webform page itself.

The first time page load, everything works. However when I do a postback
from this MVC page (which contains webform page), I got an error of invalid
viewstate, any one can help for this?

-----------------------------Exception-----------------------------
[HttpException (0x80004005): 无法验证数据。]
System.Web.Configuration.MachineKeySection.GetDeco dedData(Byte[] buf,
Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +289
System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +140

[ViewStateException: 无效的视图状态。
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.10)
Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
ViewState:
/wEPDwUKLTU2ODgwMzc3NQ9kFgICAw9kFgICAw8PFgIeBFRleHQ FEGZpcnN0IHRpbWUgdmFsdWVkZGQne8ZhAy5v8ukhe90/1ZE/Cm54hA==
Referer: http://localhost:1703/
Path: /]
---------------------------/Exception-------------------------------


Best regards,

Guoqi Zheng
http://www.ureader.com

 
Reply With Quote
 
 
 
 
Joern Schou-Rode
Guest
Posts: n/a
 
      06-09-2009
On Sun, 07 Jun 2009 08:10:29 +0200, Guoqi Zheng <(E-Mail Removed)> wrote:

> The first time page load, everything works. However when I do a postback
> from this MVC page (which contains webform page), I got an error of
> invalid viewstate, any one can help for this?


There is no concept of "post back" or "view state" in ASP.NET MVC. This
really is the key difference between the two frameworks, and trying to
work around it would probably be a Bad Idea(tm).

Read the chapter on ASP.NET MVC vs Web Forms in "Professional ASP.NET MVC
1.0" from Wrox for more detail. Part of the chapter is available here:

http://books.google.com/books?id=RWGHqKmnRBwC&pg=PT197

--
Joern Schou-Rode
http://malamute.dk/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No MVC Project Template after installing ASP.NET MVC 1.0 Crazy Cat ASP .Net 1 09-03-2009 08:02 PM
WebForms X MVC? Why MVC? Give me reasons to migrate my web apps to it please. Pros x Cons! Thanks! Paulo ASP .Net 3 12-04-2008 03:00 AM
differences between Spring WebFlow,Spring MVC,and String Portlet MVC? rmn190 Java 2 01-10-2008 02:27 AM
not declared error- control inside a control inside a webform DC Gringo ASP .Net 4 12-17-2007 02:22 AM
not declared error- control inside a control inside a webform DC Gringo ASP .Net Web Controls 3 09-14-2004 09:29 PM



Advertisments