Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Server.Transfer() problem

I am using this code...

Server.Transfer("/Student/StudentControlPanel.aspx?username=" + username);

And getting the following Exception:

InvalidOperationException : "Failed to map the path '/Student/StudentControlPanel.aspx'."

StudentControlPanel.aspx - page is located in

App Root -> Web -> Student

But my .sln file is located in

App Root -> Solution

Default.aspx is in

App Root -> Web

Can anyone give me a solution?

like image 902
user366312 Avatar asked Dec 17 '22 06:12

user366312


1 Answers

Try this:

Server.Transfer("~/Student/StudentControlPanel.aspx?username=" + username);

The tilde (~) resolves to the root of the application.

like image 183
Andrew Hare Avatar answered Dec 30 '22 14:12

Andrew Hare