lapucca
asked on
Why resonse.redirect cannot find my web form page?
Hi, I'm using asp.net 3.5 and C#. I'm running this from VS 2008 in Debug mode.
I have the following code to verify the role after the user logs in (not windows id log in using Active Directory. I'm using sql). I log in as a Administrator but it cannot find the page. Does Response.Redirect requires full http address? In the VS solution explorer, I have a Admin folder that has a web form, ManagerUsers.aspx. Why can't it find it? Thanks.
thanks
protected void loginAdapt_LoggedIn(object sender, EventArgs e)
{
if (Roles.IsUserInRole(loginA dapt.UserN ame, "Administrator"))
Response.Redirect("/Admin/ ManagerUse rs.aspx");
else if (Roles.IsUserInRole(User.I dentity.Na me, "Patient"))
{
Server Error in '/Survey' Application.
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Survey/Admin/ManagerUsers .aspx
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
I have the following code to verify the role after the user logs in (not windows id log in using Active Directory. I'm using sql). I log in as a Administrator but it cannot find the page. Does Response.Redirect requires full http address? In the VS solution explorer, I have a Admin folder that has a web form, ManagerUsers.aspx. Why can't it find it? Thanks.
thanks
protected void loginAdapt_LoggedIn(object
{
if (Roles.IsUserInRole(loginA
Response.Redirect("/Admin/
else if (Roles.IsUserInRole(User.I
{
Server Error in '/Survey' Application.
--------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Survey/Admin/ManagerUsers
--------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Use ~ sign in your page path. Like:
Response.Redirect("~/Admin /ManagerUs ers.aspx
Asim
Use ~ sign in your page path. Like:
Response.Redirect("~/Admin
Asim
>> Use ~ sign in your page path.
That sounds oddly familiar....
That sounds oddly familiar....
Use this code :
Response.Redirect("../Admin/ManagerUsers.aspx");
ASKER
I used '~' and '/' and still gets the same error. My path is C:\Projects\AdaptSurvey\Ad min\ ManagerUsers.aspx. The internet is trying to find it here http://localhost:49509/AdaptSurvey/Admin/ManagerUsers.aspx
I do restrict only login user with Admin role to enter in the web.config under this folder. Would that be a problem? Attached is my code. thank you.
ManageUsers.aspx
ManageUsers.aspx.cs
Web.config
Login.aspx.cs
I do restrict only login user with Admin role to enter in the web.config under this folder. Would that be a problem? Attached is my code. thank you.
ManageUsers.aspx
ManageUsers.aspx.cs
Web.config
Login.aspx.cs
Is your file path correct, try testing the URL in the web browser and then paste that URL in the script.
The problem is with the file path the you have mentioned in the script, its going to a unknown place in the server.
Hope this helps