设置网址www.indiaaclick.com [英] set the url www.indiaaclick.com

查看:60
本文介绍了设置网址www.indiaaclick.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户点击了网址indiaaclick.com,那么我想像这样显示网址www.indiaaclick.com


预先感谢

if user hits the url indiaaclick.com then i want display url www.indiaaclick.com like this


thanks in advance

推荐答案

通常可以在注册商级别完成.您可以创建从site.com到www.site.com的重定向.从技术上来说,"www"是一个子域. Google提供了有关如何与您的注册商联系的说明.例如,如果您使用GoDaddy,请搜索"GoDaddy重定向到子域".

另外,如果您可以访问IIS,我想您可以创建从site.com到www.site.com的重定向.

如果确实必须从ASP.NET执行此操作,并且不想安装重定向模块,则可以修改Global.asax并执行条件重定向(未经测试,因此可能无法完全按照所示方式工作):
This can typically be done at the registrar level. You can create a redirect that goes from site.com to www.site.com. The "www" is technically a subdomain. Google for instructions on how to do that with your registrar. For example, if you use GoDaddy, search "GoDaddy redirect to subdomain".

Also, if you have access to IIS, I think you can create a redirect from site.com to www.site.com.

If you really must do it from ASP.NET and you don''t want to install a redirect module, you could modify your Global.asax and perform a conditional redirect (untested, so may not work exactly as shown):
Public Class Global_asax
    Inherits System.Web.HttpApplication
    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        If Not Request.Url.Host.StartsWith("www.", StringComparison.InvariantCultureIgnoreCase) Then
            Dim builder As New UriBuilder(Request.Url)
            builder.Host = "www." + builder.Host
            Response.Redirect(builder.ToString())
        End If
    End Sub
End Class


我想输入url文本中有一个文本框.因此,首先获取文本表单textbox.
I assume,to input url text you have a textbox.So first get the text form textbox.
string url=textbox1.Text;


然后在enterbox的textbox1的Enter键按下事件中尝试..


Then in enter key press event for textbox1 try it..

string finalString="www."+url;


然后,


then,

textbox1.Text=finalString;


这篇关于设置网址www.indiaaclick.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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