Hi Everyone,

Can anyone analyze if this is the correct code for having words being "printed" onto your webpage without having to type them onto the page ?

Thanks

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Dim keyword1 As String = Request.QueryString("keyword")
Literal1.Text = keyword1

End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Literal ID="Literal1" runat="server" />
</div>
</form>
</body>
</html>

You don't have to use a literal to do this, only if it is dynamic content.

Otherwise use the simple <%= "text you want to show" %> method. It's "response.write".

You don't have to use a literal to do this, only if it is dynamic content.

Otherwise use the simple <%= "text you want to show" %> method. It's "response.write".

Hi,

Thanks for the reply. When you say dynamic content do you mean content that can be changed ?

also, if I used a "response.write" method would the code look something like this ? Would I need to change anything in the below syntax ? Thanks for everyones time.

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Dim keyword1 As String = Request.QueryString("keyword")
Literal1.Text = keyword1

End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Response.Write(literal1) runat="server">
</div>
</form>
</body>
</html>

No no no...

Anyway, Dynamic content I mean changes everytime the page loads, like database relative data. If you are grabbing the information from the database, stick with a literal control and spit it out how you were before. If it isn't, then you can use "response.write", like below:

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%= Request.QueryString("keyword") %>
<!-- or you can use the below line -->
<% response.write(Request.QueryString("keyword") %>
</div>
</form>
</body>
</html>

The tags <%= %> is short for <% response.write() %>.

You do not need System. Anything while using inline coding (coding that is on the current page). Only refer to System when you're using code-behind (including a file like: default.aspx.vb).

Hi,

Thank you for the response.

"If you are grabbing the information from the database, stick with a literal control and spit it out how you were before. If it isn't, then you can use "response.write", like below:"

I'm not

"grabbing"

the data from a database the information that I would like to insert is actually what the person types.


I can see how I would use the "response.write" command because their is know database involved but when I added just the ( <% response.write(Request.QueryString("keyword") %> ) for some reason it dosen't work on my page.

( http://www.greatratesfinancial.com/landing-page-practice-7.aspx )


I've uploaded the above code to the page called ( <%= Request.QueryString("keyword") %> )


( http://www.greatratesfinancial.com/landing-page-practice-6.aspx )


and my last question would be this, how do I check the code to see if its working ? and also, in order to "print" the words onto the page do I need to add a label or text box in the code ?

Thanks again for your time. I appreciate your help.

Scm22ri

No you don't need anything to print the words on the page, except for ASP.NET.

This didn't work because there is a missing parenthesis at the end:

<% response.write(Request.QueryString("keyword")) %>

The code should automatically print the information onto the screen, without any additional controls. You should see immediate results. Please copy / paste your entire code if you can. Thank you.

Oh also, you need to make sure you have a querystring to pull information from. Try this link:

http://www.greatratesfinancial.com/landing-page-practice-6.aspx?keyword=lkjasdf

A querystring is the information after the question mark received from a form with the action GET.

Hi,

Thanks a lot for your help. I really appreciate it !

Both landing pages are working ! but where would I need to add the "get method" in the code ? Would the "get method" need to be placed in the page load event ? or under

"<%= Request.QueryString("keyword") %>" ? syntax ?

get method is on the form that submits. There are two ways to purposefully edit the querystring:

1. Form --> method="get"
Example: <form action="" method="get" name="form1">
(but keep in mind, method is useless with "runat=server")

2. Place links with the querystring already within them.
Example: <a href="howdy.aspx?arg=1&arg=2&arg=3">I'm a link!</a>

Hello,

Thanks for the reply. What I'm trying to do is this, when a person is on a search engine and query "rhode island insurance" I want "rhode island insurance" on my landing page.

I think I'm really close with the above code but I don't have other pages to link to that are on my landing page. Should the above code in your (4th) reply be sufficient ? for what I need to do ?

Thanks again for your help. I appreciate it.

Scm22ri

Depends.. is "rhode island insurance" what you do, what your site is about?

If it is, then you can have it on the page static yes.

However, if you don't, then you need to do a much more complicated mess.

First, you will need to see what major engines you would like to use for this, as you will have to code for each specific one.

You will then use the "HTTP_REFERER" with the server variables (Request.ServerVariables("HTTP_REFERER")) and check which engine the user is coming from. Then test each engine how it sends its information to each website. You then have to retrieve the information, and display it yourself.

However, I am not knowledgeable in that portion.

Now how the way search engines work is that they "spider" through your site, your links, and your pages about once a month. And during this time, they see all your links with querystrings, possibilities of dynamic links being created, etc. They then search all text within your site and relate it back to their system where they basically index it. The search engines don't necessarily like querystrings, but they love rewritten querystrings. THis is how you see sites with the following url: "websitename.com/google/77/2892749/images/2987/"
That url is then rewritten with their program as:
websitename.com/google.aspx?arg1=77&arg2=2892749, then the rest is more for inner page where it finds the base of the images folder witht he corresponding folder named 2987.

This is more referenced as SEO since the better your URLs are, the more readable they are to spiders, the higher you are going to be on the search engine's list for popular words, especially INSURANCE!

So then it comes back to, is this what your website is about or are you just trying to write on your page what people ask for in search engines to drag attention to your site?

Hi,

"So then it comes back to, is this what your website is about or are you just trying to write on your page what people ask for in search engines to drag attention to your site?"

Thanks for the reply. My site is going to be about insurance in all 50 us states so yes "rhode island insurance", "florida insurance" etc... These are the areas I'm trying to target and also their local cities/towns etc ...

In regards to "grabbing peoples attention" this is what I'm trying to do. I figure if I can grab people attentio nthe longer that visitor is going to stay on my internet site and hopefully become a member and come back for their future insurance needs etc... I only have one question in regards to this, is their anyway to make the "appearance" of the words better looking. Perhaps bold text ? in the middle of the page?

"Now how the way search engines work is that they "spider" through your site, your links, and your pages about once a month. And during this time, they see all your links with querystrings, possibilities of dynamic links being created, etc. They then search all text within your site and relate it back to their system where they basically index it. The search engines don't necessarily like querystrings, but they love rewritten querystrings. THis is how you see sites with the following url: "websitename.com/google/77/2892749/images/2987/"
That url is then rewritten with their program as:
websitename.com/google.aspx?arg1=77&arg2=2892749, then the rest is more for inner page where it finds the base of the images folder witht he corresponding folder named 2987."

This just seems that all of the major search engines need to "dig" more for search results and they like that ? I thought seo was all about anchor text and great headlines :)

Thanks again for your responses.

Scm22ri

This article has been dead for over six months. Start a new discussion instead.