K
Keith G Hicks
I'm confused about how to code a link button to go to the page I need
(asp.net 2.0)
My root is "Website1"
Here's the layout for the purposes of this question:
Website1 (folder)
masterpage.master (in the root)
Admin (folder off the root)
SendMail.aspx (uses the master)
LoggedInUsers (folder off the root)
EditLoginInfo.aspx (uses the master)
Default.aspx (this is in the root and also uses the master)
Most of the pages are in the root including the master page. All the pages
in the system use that master page.
On the master page I have a line of text like this:
<a href="LoggedInUsers/EditLoginInfo.aspx">Edit Login Info</a>
When I'm on the Default.aspx page and click the link, it goes to the page I
expect it to. However, when I'm on the SendMail.aspx page and I click the
"Edit Login Info" link, I get the error: "The resource cannot be found"
Requested URL: /Website1/Admin/LoggedInUsers/EditLoginInfo.aspx
I understand why because obviously there's no such folder layout as
/Website1/Admin/LoggedInUsers/ so it's not finding the page but I don't know
what to change to make it work. If I change the link to read
<a href="~/LoggedInUsers/EditLoginInfo.aspx">Edit Login Info</a>
I get the same error: "The resource cannot be found"
and:
Requested URL: /Website1/Admin/~/LoggedInUsers/EditLoginInfo.aspx
Now what's really confusing to me is if I use a LinkButton instead of just
text with href, and set the PostBackUrl in the button as follows:
PostBackUrl="~/LoggedInUsers/EditLoginInfo.aspx"
then that link button works fine no matter where I am in the site. Doesn't
matter what folder I'm in, it always finds the page I need.
Do I have to use link buttons with PostBackUrl whenever I'm dealing with
master pages and subfolders or is there a way to use href in text and get
this to work right?
I hope I've made the problem clear enough.
Thanks,
Keith
(asp.net 2.0)
My root is "Website1"
Here's the layout for the purposes of this question:
Website1 (folder)
masterpage.master (in the root)
Admin (folder off the root)
SendMail.aspx (uses the master)
LoggedInUsers (folder off the root)
EditLoginInfo.aspx (uses the master)
Default.aspx (this is in the root and also uses the master)
Most of the pages are in the root including the master page. All the pages
in the system use that master page.
On the master page I have a line of text like this:
<a href="LoggedInUsers/EditLoginInfo.aspx">Edit Login Info</a>
When I'm on the Default.aspx page and click the link, it goes to the page I
expect it to. However, when I'm on the SendMail.aspx page and I click the
"Edit Login Info" link, I get the error: "The resource cannot be found"
Requested URL: /Website1/Admin/LoggedInUsers/EditLoginInfo.aspx
I understand why because obviously there's no such folder layout as
/Website1/Admin/LoggedInUsers/ so it's not finding the page but I don't know
what to change to make it work. If I change the link to read
<a href="~/LoggedInUsers/EditLoginInfo.aspx">Edit Login Info</a>
I get the same error: "The resource cannot be found"
and:
Requested URL: /Website1/Admin/~/LoggedInUsers/EditLoginInfo.aspx
Now what's really confusing to me is if I use a LinkButton instead of just
text with href, and set the PostBackUrl in the button as follows:
PostBackUrl="~/LoggedInUsers/EditLoginInfo.aspx"
then that link button works fine no matter where I am in the site. Doesn't
matter what folder I'm in, it always finds the page I need.
Do I have to use link buttons with PostBackUrl whenever I'm dealing with
master pages and subfolders or is there a way to use href in text and get
this to work right?
I hope I've made the problem clear enough.
Thanks,
Keith