Portal Engine
Version 3.x > Portal Engine > Server.Transfer method View modes: 
User avatar
Member
Member
yko - 11/12/2008 8:29:25 AM
   
Server.Transfer method
Hi,

can I use Server.Transfer method (instead of Response.Redirect) in my user control?

Thanks

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/12/2008 10:04:49 AM
   
RE:Server.Transfer method
Hello,

Yes, you can use the Server.Transfer method in your project. We are using the same method in the file ~CMSDesk\Content\edit.aspx.cs in the "// Analyze the action parameter" section.

Best Regards,
Boris Pocatko

User avatar
Member
Member
yko - 11/12/2008 10:56:41 AM
   
RE:Server.Transfer method
yes, but this is CMSDesk.
I'm getting "The file '/Website/Page1.aspx' does not exist" in my user control if I use Server.Transfer("~/Page1.aspx").
And "The file '/Website/CMSPages/Page1.aspx' does not exist" in my user control if I use Server.Transfer("Page1.aspx").

Website - folder with my user controls, on the same level as CMSDesk.
Redirect works.

Thanks

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/12/2008 11:28:48 AM
   
RE:Server.Transfer method
Hello,

Could you please make sure the specified page is available in the given path?
We use this method in this file:

~CMSDesk\Content\edit.aspx.cs
around line 90

I hope this helps.

Best Regards,
Boris Pocatko

User avatar
Member
Member
yko - 11/13/2008 1:41:18 AM
   
RE:Server.Transfer method
Hello,

you mean if http://website/Page1.aspx is available?
yes, I can see it if I open http://website/Page1.aspx in browser.
I created this page in CMS like other pages.

Server.Transfer("~/CMSDesk/Content/newpage.aspx") works.
This page physically exists in this folder.
But Page1.aspx is in CMS db.

Thanks

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/13/2008 10:26:21 AM
   
RE:Server.Transfer method
Hello again,

I tried your approach and I've got the following error:

Error executing child request for ...

I found a KB article on Microsoft about this at:

http://support.microsoft.com/kb/320439

So it seems you will have to use the Response.Redirect method.
I am sorry I couldn't help you with this.
I hope there is no problem in using the mentioned function.

Best Regards,
Boris Pocatko

User avatar
Member
Member
lanzowallace08-yahoo - 1/25/2010 6:12:47 PM
   
RE:Server.Transfer method
I have managed to get my site to perform the server.tranfer but I am having a problem accessing the objects (data) from the sending page. How do I access an object in an Kentico page?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/26/2010 11:10:04 AM
   
RE:Server.Transfer method
Hello,

Could you please describe in more detail, what you are trying to do?

Best regards,
Boris Pocatko

User avatar
Member
Member
Praveen.Gaddam-raybiztech - 6/7/2010 8:39:49 AM
   
RE:Server.Transfer method
My Page is in CMSdesk

-Root
Default.aspx
Default2.aspx

When try to redirect through Server.Transfer

I am getting Error like "error executing child request server.transfer"

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/10/2010 2:05:47 AM
   
RE:Server.Transfer method
Hello,

Could you please try to use the Response.Redirect method instead?

Best regards,
Boris Pocatko

User avatar
Member
Member
sprintstar - 7/6/2010 4:00:46 AM
   
RE:Server.Transfer method
I just stumbled across the same problem. I think the issue is that Server.Transfer is not finding the path that you specify. It works when the browser requests it, because Kentico turns that request into an actual path internally. Thats why it works when you specify the actual path of your aspx file. What I was trying to do was something like:


Context.Items["LastException"] = Server.GetLastError();

Server.Transfer("~/Fail.aspx");
Server.ClearError();


on Application_Error in Global.asax, but I will need to find some other way of doing it. I have shelved that bit of code for now, and will come back to it later! :)