Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

i got problem when access to the home page. at first i use "server.transfer" but then still no works.

here the code:


C#
Session["username"] = username.Text;

            if (roles == "administrator,user")
            {
                Server.Transfer("~/Admin/Home.aspx");
            }
            else if (roles == "manager,user")
            {
                Server.Transfer("~/Manager/Home.aspx");
            }
            else if (roles == "user")
            {
                Server.Transfer("~/User/Home.aspx");
            }
when i access to manager and admin home page it works.but when i want to access to user homepage; the error appear: Error executing child request for /OMC1/User/Home.aspx.

pls guys help me.i have to submit the project asap

thanks a lot
musiw.
Posted
Updated 31-May-12 22:05pm
v2

Use Response.Redirect. Documented issue by MS, here:
PRB: "Error Executing Child Request" Error Message When You Use Server.Transfer or Server.Execute in ASP.NET Page[^]

Alternatively, similar issue resolved here: Server.Transfer throws Error executing child request. How to resolve?[^]
Use: HttpContext.Current.RewritePath("somefile.aspx");
 
Share this answer
 
Comments
musiw 2-Jun-12 0:26am    
i already try your solution, rewritepath("page.aspx"); but after i login the login page appear 2 times.i have to login again
The another way to resolve this error is to add an Handler in webconfig file:
http://www.banmanpro.com/support2/Error_executing_child_request.asp[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900