Correct url formatting on a ASPX page

Question

My current url is http://www.domain.com/Article.aspx?Id=1

For SEO I want http://www.domain.com/my-first-article-for-mywebsite/1.aspx

I am binding the data on my aspx page heres the code for it :

<% foreach (System.Data.DataRow item in dt.Rows)
     {  
        %>

            <div class="col-xs-6 col-sm-3 mix livefeeds News">
                    <div class="work-item">
                        <div class="image-holder">
                            <a href="<%="Article.aspx?Id=" + item["Identity"].ToString()%>">
                           <%-- <a href="<%="item[\"Url\"]" + "Article.aspx"%>">--%>
                                <img src="<%=item["ImagePath"].ToString()%>"/>
                                <h4>
                                    <span><%=item["Headline"].ToString()%></span>
                                    </h4>    
                            </a>
                        </div>
                    </div>
         </div>


    <%
    }   
    %>

Now I have my required url in url column so am getting stuck at the syntax to make the url so that after making the url I will get the Id and pass it to the store procedure to get the data.

Need help in this line,am unable to code the exact syntax,as there are lots of errors.

 <%--<a href="<%="item[\"Url\"]" + "Article.aspx"%>">--%>

Show source
| asp.net   | c#   | seo   2016-12-28 04:12 0 Answers

Answers ( 0 )

◀ Go back