vb.net中的google url问题 [英] google url probleam in vb.net

查看:81
本文介绍了vb.net中的google url问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

我有问题,在Google索引中创建了重复的URL,但是此URL重定向了我的原始URL,我已经开发了此代码

hello friend

i have i issue,in google index my duplicate url are create but this url redirect my orignal url i have develop this code

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
       ' Code that runs when a new session is started
     

       Dim urldata() As String
       Dim casturl As String
       Dim str As String
       str = Request.RawUrl.ToString
       If str.EndsWith(".aspx") Then
           Exit Sub
       End If
       If Not str.EndsWith(".html") Then
           urldata = Split(str, "=")
           casturl = urldata(urldata.Length - 1).ToString()
           Dim con As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("abc").ConnectionString)
           Dim cmd As New SqlCommand
           con.Open()
           cmd.CommandType = Data.CommandType.Text
           cmd.CommandText = "select catName from pqr where catId IN(select parentId from categories where catId IN(select categoryId from registerdata where navTag='" & casturl & "'))"
           cmd.Connection = con
           Dim geturl As String
           geturl = Convert.ToString(cmd.ExecuteScalar)
           Response.Redirect("http://www.example.com/ads-" & Trim(geturl) & "/" & Trim(casturl) & ".html")
       End If



   End Sub



此代码仅适用于第一次..我单击了其他不起作用的链接

请帮助我

谢谢u



this code is work only for first time..i am click other link that is not working

plz help me

thank u

推荐答案

在Application_BeginRequest事件中执行此操作. Session_start取决于会话时间.当会话仍在session_end时间开始时,它将起作用.
do this in Application_BeginRequest event. Session_start depend on session time. it work when session start still to session_end time.
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
       {
           // your codes here
       }


这篇关于vb.net中的google url问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆