473,842 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with anchor tag in '.aspx' page

126 New Member
Hello everyone,

I am new beginner to asp.net and c#.

I have the following anchor tag in my "Index.aspx " page:
<a href="www.googl e.com" target="_blank" >Google</a>

And, when I click on the above link it is going to:


instead of:
"www.google.com "

Please help me out.

Thanks a million in advance.
Nov 26 '08 #1
14 29320
Curtis Rutland
3,256 Recognized Expert Specialist
Change your link to:
Expand|Select|Wrap|Line Numbers
  1. <a href="http://www.google.com" target="_blank">Google</a>
and see if that works.
Nov 26 '08 #2
7,872 Recognized Expert Expert
This is not a .NET issue, this is an "HTML 101" issue.
You need to have the http:// in your links.
I also recommend a basic tutorial in html design.

I will move this thread.
Nov 26 '08 #3
126 New Member
Hello Guys,

The link is not going to Google home page even if I include 'http://' in the href tag.

<a href="www.googl e.com" target="_blank" >Google</a>

The above mentioned link is working perfectly fine if I use in html page (say index.html)

But, if I use the same above link in a .NET page (say index.aspx), the page is automatically adding the fully qualified URL of ASP.NET server to the URL in href attribute.

Please note that the above mentioned error is occurring only in .NET pages.
Nov 26 '08 #4
Curtis Rutland
3,256 Recognized Expert Specialist
Navigate to the page, and then View Source. Tell us if the source still shows the same thing, or if it has changed itself to include the fully qualified link.
Nov 26 '08 #5
126 New Member
Thanks for the reply.

The 'index.aspx' page source code still contains the following link

<a href="www.googl e.com" target="_blank" >Google</a>

Please help me out. I am breaking my head to solve this issue from past 5 hours.

Nov 26 '08 #6
Curtis Rutland
3,256 Recognized Expert Specialist
Well, then it's really not an ASP.NET issue, because that all happens on the server. It is strange though...

Let me think about that....
Nov 26 '08 #7
7,435 Recognized Expert Expert
"target" is an attribute used in frames and that's why it's acting strange. I'll get back to this in a sec.
Nov 26 '08 #8
7,435 Recognized Expert Expert
I haven't dealt with this in years but you would set the href for where you wanted the frame to get its content from and target would be the name of the frame to get the content. So what you have now won't work that way.

Sorry, gotta go.
Nov 26 '08 #9
126 New Member
Hello InsertAlias,

Sorry for not closing the webpage and running it again through the ".Net" server after adding 'http://' to the href attribute in <a> tag. I only refreshed it previously.

Anyways, now I am able to open Google page using the following link:

<a href="http://www.google.com" target="_blank" >Google</a>

But this is what I am doing, I am asking the user to enter URL in a textbox and when they click submit button the URL will be stored in the database.

And from the database I am retrieving the URL and creating <a> tags as follows:

Expand|Select|Wrap|Line Numbers
  1. <asp:Repeater ID="CMLinkRepeater" runat="server"><ItemTemplate> 
  2.     <a href="<%#DataBinder.Eval(Container.DataItem,"CMLink_URL") %>" target="_blank"><%#DataBinder.Eval(Container.DataItem,"CMLink_Name") %></a>
  3.     <br /> 
  4. </ItemTemplate></asp:Repeater>
But, with the above procedure the user is able to open the link only if they enter, say "http://www.google.com" in the textbox.

What if they enter "www.google.com " in the textbox? How can I overcome this issue?
Nov 26 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

by: neverstill | last post by:
hi- I have <a> tags in my DataList. For the href property, I want to do something like this: <a href='~/Default.aspx?show=Support&disp=Faq&p=<%# DataBinder.Eval(Container.DataItem, "name")%>' runat=server>some link</a> Looks pretty straight forward, but when I add the runat=server property it stops parsing the <% %> block correctly.
by: Roshawn | last post by:
Hi All, I have created a web user control. This control mimics the numeric pagers seen on many online bookstores. I made this user control using the Repeater. It is populated dynamically. Here's my code for its presentation: <asp:Repeater id="Repeater1" enableviewstate="False" runat="server"> <HeaderTemplate><div id="pager"></HeaderTemplate> <ItemTemplate><a href='<%# DataBinder.Eval(Container, "DataItem.Number",
by: DonnyW | last post by:
I am working on an application that displays a list of items (biglist.aspx). With each item, there is a link that takes the user to another aspx page for updating the specific details of that item (updatedetails.aspx). That page has a button event that saves changes and then redirects back to the main list. Here's my issue -- the list page takes a parameter in the querystring. I have set up anchor tags for each item within the list....
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a hyperlink control and you assign the navigateurl property = "../#anchor" whereby you want to add this # reference to the current url the url ends up with the #anchor twice.
by: Ken Slight | last post by:
Hello. Does anyone know how to navigate to a specific anchor within an ASPX page? For example, I have <a name='Test'>Hey there</a>, and I want to direct someone to that anchor in the PageLoad using code. In other words, if someone navigates to the default.aspx page, I want to immediately take them to the #Test anchor. Thanks, Ken
by: remy.bur | last post by:
Hi, When adding an anchor (which is runat="server") in a user control, the link generated will be based on the user control location and not on the page which is using the control location. For example, if the user control is located in an include folder, here is what I will get: <a href="include/home.aspx"> instead of <a href="home.aspx">
Steve Kiss
by: Steve Kiss | last post by:
Hi. I am developping a site for which one of the pages uses querry strings to pass some parameters. I can use the querry strings if I call the page from a plain html anchor. However, when I add the URL to the sitemap I get the following error: The 'url' property had a malformed URL This is the offending URL: ViewImages.aspx?area=M3000Gallery&areaName=Merlin%203000%20Press%20Brake%20Guarding I also tried:...
by: shapper | last post by:
Hello, I am applying a style to a anchor tag. This anchor is created by an ASP.NET page and is inside a list item. I know the style is working because I applied it to the anchor in a page that has only this. .Test { background-color: #101010;
by: shahidrasul | last post by:
hi in my project when i click on logout anchor it goes to logout page and my code in logout page is if (Session != null) { Session = null; Session.Abandon(); Response.Clear(); FormsAuthentication.SignOut(); Response.Redirect("login.aspx"); }
by: pavanip | last post by:
Hi, I have one web page in that i am using one anchor tag and linking to some other page in Anchor href. Now i want to raise anchor click event automatically in page load without clicking and navigate to that page. I want to write anchor tag like this <a href="AboutUs.aspx?TB_iframe=true&height=500&width=800" class="thickbox">About us</a> But it has to go to Aboutus.aspx page without clicking. Is there any way to do that uisng...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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,...
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...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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.