-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Vadi_gm
Message 1 in Discussion
Hello All,
I was trying to implement MVC architecuture in asp.net.
I am facing some problems with Server.Transfer
I have defined a class which inherits from System.Web.UI.Page called 'Controller'. I
have overridden the OnLoad method.
Now my webpage say Page1 inherits Controller. Hence my overridden 'OnLoad' method
would be called before the page load
In my Controller class i have the code:
public class Controller : System.Web.UI.Page{
protected override void OnLoad(EventArgs e)
{
string path = Request.Path;
if(path.CompareTo("/MVCTest1/Page1.aspx") == 0) //Page1
{
Server.Transfer("/MVCTest1/Page2.aspx"); //Response.Rediect Works, but
Server.Transfer does not
}
}
}
and
this is code behind:
public class Page1 : Controller
{
private void Page_Load()
{
//.........
}
}
The above code gives the error:
Server Application Unavailable
The web application you are attempting to access on this web server is currently
unavailable. Please hit the "Refresh" button in your web browser to retry your
request.
Administrator Note: An error message detailing the cause of this specific request
failure can be found in the application event log
of the web server. Please review this log entry to discover what caused this error to
occur.
But if i use 'Response.Redirect' instead of 'Server.Transfer' everything works as
expected, why does not 'Server.Transfer' work at this stage in the Page cycle??
One more thing if i override the OnLoad Method directly in the web page instead of an
intermediatary class (Ex like Controller class above) Server.Tranfser works fine!!!!
How is this?
please do reply asap
Vadiraj
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]