473,811 Members | 2,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

link URL confusion

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.mast er (in the root)

Admin (folder off the root)
SendMail.aspx (uses the master)

LoggedInUsers (folder off the root)
EditLoginInfo.a spx (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="LoggedInU sers/EditLoginInfo.a spx">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.a spx

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.a spx">Edit Login Info</a>

I get the same error: "The resource cannot be found"

and:

Requested URL: /Website1/Admin/~/LoggedInUsers/EditLoginInfo.a spx

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.a spx"

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


Mar 6 '08 #1
2 1574
I should point out that if I put the root in the <a href ... like this:

<a href="/Wesite1/LoggedInUsers/EditLoginInfo.a spx">Edit Login Info</a>

It works fine, but everthing I read says it's bad practice to hardcode the
root anywhere.

Keith
Mar 6 '08 #2
Hello Keith,

You can use the <asp:hyperlin k /control to add a link to a different page.
it has a property in which you can set the url using the ~/path notation.
The hyperlink control will automatically resolve the url to teh correct value
depending on which page is using the masterpage. Just like your LinkButton
is doing. Another thing you could try is to set the runat="server" attribute
on your <a href=".."tags.

--
Jesse Houwing
jesse.houwing at sogeti.nl
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.mast er (in the root)
Admin (folder off the root)
SendMail.aspx (uses the master)
LoggedInUsers (folder off the root)
EditLoginInfo.a spx (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="LoggedInU sers/EditLoginInfo.a spx">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.a spx

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.a spx">Edit Login Info</a>

I get the same error: "The resource cannot be found"

and:

Requested URL: /Website1/Admin/~/LoggedInUsers/EditLoginInfo.a spx

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.a spx"

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

Mar 7 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2197
by: Dodo | last post by:
Is it possible to create a link that can post a value to an ASP page without java?
7
23027
by: lawrence | last post by:
In my style sheet I've set the links like this: a:link{ text-decoration:none; } I did that for the pseudo classes and I also did that for the image tag. Yet there are still link lines around the images. Why? It's on this page:
14
3953
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The css for formatting the menu links is: #menu a:hover { background-color: #E00080; color: white;
5
4760
by: Harry | last post by:
CSS Description: Table contains a column of td cells with links. Achieved: 1. Entire link cells highlight when hovered. 2. The entire area of these cells are clickable. Problem:
5
2131
by: sriram | last post by:
I have the following: class BSA { ... ... ... ... public: enum VRGAttrId {
26
3862
by: Harrie | last post by:
Hi, After Brian mentioned the use for <link rel=..> for navigational purposes in another thread, I've been looking into it and found that HTML 3.2 has two other recognized link types than HTML 4.01, which are "top" and "search". I compared these two pages: http://www.w3.org/TR/REC-html32-19970114#link http://www.w3.org/TR/html4/types.html#type-links
3
2274
by: Alex Shturm | last post by:
Hi, I am trying to activate incremental link using VC7 (.NET 2003) on a pretty big project (executable size is more than 100Mb, and it gets linked from several dozen of libraries and object files of different sizes - from less than 1Mb to tens of MBs). The problem is that option /incremental:yes does not have any effect on the link time. I observe that the linker removes existing executable and re-links it from scratch.
26
2924
by: Mica Cooper | last post by:
Hi, I need to pass some info in a javascript submit. <a href="javascript:document.formName.submit();">Submit Form</a> Normally a link would do page.jsp?x1=1&x2=2&x3=3 and you would pull x1, x2, x3. I have no clue how to do this with a link submit. Thanks,
11
8135
by: mosscliffe | last post by:
I am trying to create a link to a file, which I can then use in an HTML page. The system is Linux on a hosted web service, running python 2.3. Other than that I have no knowledge of the system. The link is created OK, but when I try to use it as filename for the IMG TAG, it does not get displayed. The page source of the created page is pointing to the link as temp/test1.jpg
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10393
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.