Response.Redirect Syntax in ASP.NET

Hello Experts,

I'm having an issue with the syntax for the Response.Redirect command. I combined all the projects into 1 solution thinking this would be easier to use Session variables with and make the Response.Redirect more straightforward.

I'm initially launching the app from IPED_Hospice_Test.Login.aspx (http://localhost:57848/Login.aspx) and once validation occurs going to IPED_Reporting.ReportSelector.aspx (http://localhost:57848/IPED_Reporting/ReportSelector.aspx).  I'm using Response.Redirect("~/IPED_Reporting/ReportSelector.aspx", False) . I use the tilde because the pages are in different folders (as seen in the Solution Explorer screenshot).

In VS I've set to use the Development Server with port 57848, I've tried IIS and IIS Express. Any help will be appreciated.

Thank you,

Jack W
VS 2010 Solution Explorer
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob BenderCommented:
Are you getting a 404 Error, or what?

If not mistaken, the  ~/  points you to the root of the website.   If that root is IPED_Reporting, then your entry of  "~/IPED_Reporting/ReportSelector.aspx" would be trying to go to an IPED_Reporting folder inside the root named IPED_Reporting.

I hope my thinking is right.

You might be able to use a Page TRACE, which would appear on your browser, it may help.  Instructions are at 

JackW9653Author Commented:
Thanks Bob. Yes it's a 404 - 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: /IPED_Reporting/ReportSelector.aspx

i'll check out the Page Trace link and IPED_Reporting is not at the root of the website but a folder.

JackW9653Author Commented:
Bob, The Trace Link only fired for the Login page and it had the Session variables i was expecting but when it hit the Response.Redirect line I got the 404 again. I changed that line to Response.Redirect("/IPED_Reporting/ReportSelector.aspx") and  Response.Redirect("IPED_Reporting/ReportSelector.aspx") but got the 404 on both.

Any other ideas?

Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Bob BenderCommented:
Assuming that you are in the IPEDHospice folder when trying to run....

../IPEDReporting/IPEDReportSelector.aspx?    Meaning go back a level.... the go to the IPEDReporting folder, and open the page.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JackW9653Author Commented:
Hi Bob,

I tried the new target but I'm getting a different error, ' Cannot use a leading .. to exit above the top directory.' You know it's just sad when a different error is progress. Thanks for sticking with this.

Bob BenderCommented:
Based on the pic above, what URL are you using to get to the point where the error occurs?
JackW9653Author Commented:
Hi Bob,

Thank you for following up on this. I wound up just combining the 2 projects and eliminated the problem. Now I'm using:                     Response.Redirect("~/ReportSelector.aspx", False), and this allows the Session ID to stay the same. The problem before was different Session variables.

Thanks again,

JackW9653Author Commented:
Very thorough.
Bob BenderCommented:
ahhhh, that wouldn't have been where I woulda thought.    Good to know what fixed it for future.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.