Invalid file name for monitoring:

  • Thread starter Thread starter Jo67
  • Start date Start date
J

Jo67

I am building my first ASP.NET application, but I have a problem with
some code basically copied from the IBuySpy Portal (which I'm learning
from), for adding a new user to the database. The user is added to
the database alright, but then the application crashes on the line
that reloads the page with the new parameters:

Response.Redirect(("~/memberdetails.aspx?memberid=" & memberId &
"&membername=" & memberName))

giving the following error:

Invalid file name for monitoring:
'c:\inetpub\wwwroot\ThirdYearProject\~'. File names for monitoring
must have absolute paths, and no wildcards.

I'm flummoxed as to why this line is fine in the portal, but not in my
app. Can anyone shed any light, please?
 
The problem looks like it is in the usage of the tilde (~) which stands for
the root of the Web application.

Is the portal code intended to work from the root (e.g., wwwroot) rather
than from a subdirectory (e.g., ThirdYearProject)? Is ThirdYearProject set
as an application in IIS?

Try dropping the first forward slash after the tilde. Then try dropping the
tilde?

Are you sure of the code/syntax in the Response.Redirect? The double
brackets seem odd.

Ken
Microsoft MVP [ASP.NET]
 
Thanks, I found the problem. I was using DateTime.Now.ToString as
part of the membername string that went into the database. I figured
that was okay because the portal does that for its "friendlyName"
string which also goes into the database.

The difference between the IBuySpy portal and my application was that
"friendlyName" does not then become a parameter in the URL, which is
what I was trying to do with my "membername". Once I changed that, my
application works fine.

Thanks for taking the time to respond.
 
Back
Top