Solved

Why resonse.redirect cannot find my web form page?

Posted on 2011-03-13
7
307 Views
Last Modified: 2012-05-11
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(loginAdapt.UserName, "Administrator"))
            Response.Redirect("/Admin/ManagerUsers.aspx");
        else if (Roles.IsUserInRole(User.Identity.Name, "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
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 250 total points
ID: 35125634
Is "Admin" in the root folder of your site? If so, try using the "root" indicator ( ~ ):
Response.Redirect("~/Admin/ManagerUsers.aspx");

Open in new window

0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 250 total points
ID: 35125638
check your path and folder structure
http://localhost/Survey/Admin/ManagerUsers.aspx

is it like this

share your folder sturure for more clarity
0
 
LVL 17

Expert Comment

by:Shinesh Premrajan
ID: 35125672
/Survey/Admin/ManagerUsers.aspx

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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35125721
Hi,

Use ~ sign in your page path. Like:
Response.Redirect("~/Admin/ManagerUsers.aspx

Asim
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35125731
>>  Use ~ sign in your page path.

That sounds oddly familiar....
0
 
LVL 12

Expert Comment

by:starlite551
ID: 35125747
Use this code :
Response.Redirect("../Admin/ManagerUsers.aspx");

Open in new window

0
 

Author Comment

by:lapucca
ID: 35170355
I used '~' and '/' and still gets the same error.  My path is C:\Projects\AdaptSurvey\Admin\ 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
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question