Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

Response.redirect (The resource cannot be found)

Hi

VS 2005 and .Net framework 2

I am redirecting to a folder within the app but get message that resource can't be found
while working on a single enterprise whereas others go through to the next screen.

My redirect is :
            Response.Redirect("~/Forms/frmPart2.aspx?Unit_Nbr=" & Trim$(Master.txtNumberENlbl.Text) & "&USICode=" & Trim$(Master.txtUSICodee.Text) & "&SurveyDate=" & Trim$(Master.lblSurvey_CodeR.Text) & "&LegalName=" & Trim$(Master.txtLegalTradeNamee.Text) & "&Phone=" & Trim$(Master.txtContactNumberr.Text) & "&Ou_Nbr=" & Trim$(Master.txtNumberOUlbl.Text) & "&MaintUser=" & Trim$(MaintUser) & "&MaintDate=" & Trim$(Now.Date) & "&Status_Colour=" & Trim$(Master.txtStatuSS.Text) & "&SystemMode=" & Trim$(Master.lblModes.Text))

Error given is:

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.  P
lease review the following URL and make sure that it is spelled correctly.

Requested URL:  /Agriculture 2010/Forms/~/Forms/frmPart2.aspx

What could be the cause of : '/~/' since I am requesting  /Agriculture 2010/Forms/frmPart2.aspx

It seems to be looking in two forms folders and there is this /~/ in between.
The forms are in the Agriculture 2010 folder, being the project folder.

Please assist with a solution.

Thanks, Mandyprogza


0
MandyProgza
Asked:
MandyProgza
1 Solution
 
John EastonDirectorCommented:
I have never used ASP.NET, however in classic ASP to go back a folder you should use '../' in place of '~/'

I this doesn't apply to .NET I'm sure someone will correct me!
0
 
vbighamCommented:
I believe JEaston is right.  

Also, if the page is in the same folder, I think you might be able to just use that name by itself.

try:
Response.Redirect("frmPart2.aspx?Unit_Nbr=" & Trim$(Master.txtNumberENlbl.Text) & "&USICode=" & Trim$(Master.txtUSICodee.Text) & "&SurveyDate=" & Trim$(Master.lblSurvey_CodeR.Text) & "&LegalName=" & Trim$(Master.txtLegalTradeNamee.Text) & "&Phone=" & Trim$(Master.txtContactNumberr.Text) & "&Ou_Nbr=" & Trim$(Master.txtNumberOUlbl.Text) & "&MaintUser=" & Trim$(MaintUser) & "&MaintDate=" & Trim$(Now.Date) & "&Status_Colour=" & Trim$(Master.txtStatuSS.Text) & "&SystemMode=" & Trim$(Master.lblModes.Text))

Also, I don't know if you will find it easier.. But I find it easier to read when I use String.Format to construct longer strings like these.

Maybe something like this:
 
Dim redirectUrl As String = _ 
String.Format("../Forms/frmPart2.aspx?Unit_Nbr={0}&USICode={1}&SurveyDate={2}&LegalName={3}&Phone={4}&Ou_Nbr={5}&MaintUser={6}&MaintDate={7}&Status_Colour={8}&SystemMode={9}", _ 
        Trim$(Master.txtNumberENlbl.Text), Trim$(Master.txtUSICodee.Text), _ 
        Trim$(Master.lblSurvey_CodeR.Text), Trim$(Master.txtLegalTradeNamee.Text), _
        Trim$(Master.txtContactNumberr.Text), Trim$(Master.txtNumberOUlbl.Text), _
        Trim$(MaintUser), Trim$(Now.Date), Trim$(Master.txtStatuSS.Text), _ 
        Trim$(Master.lblModes.Text))

Response.Redirect(redirectUrl)

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now