Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Why resonse.redirect cannot find my web form page?

Posted on 2011-03-13
7
Medium Priority
?
309 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 1000 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

730 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