Click here to Skip to main content
15,510,771 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have one application,
my actual url is: WWW.MyApplication.com
when i tried to link the actual url it takes me to WWW.MyApplication.com\?GCLID=9823492374ds32god3298

with this url my site not loaded properly i.e. images not shown
i have to access GCLID in my application i.e. when user tried the url with gclid, i have to remove gclid in my application.

However could someone please provide me with sample code or an application using GCLID.

Thanks in advance......
Posted
Updated 28-Feb-12 19:31pm
v3
Comments
Herman<T>.Instance 28-Feb-12 5:24am    
what have you tried?
ZurdoDev 28-Feb-12 8:19am    
Need more details.
Ramanujam Shankar 29-Feb-12 0:29am    
I have one application,
my actual url is: WWW.MyApplication.com
when i tried to link the actual url it takes me to WWW.MyApplication.com\?GCLID=9823492374ds32god3298

with this url my site not loaded properly i.e. images not shown
i have to access GCLID in my application i.e. when user tried the url with gclid, i have to remove gclid in my application.

Please any one provide me with sample code or application using GCLID

Thanks in advance.....

I found the one solution. i.e. have to rewrite the url in web.config file.

The Code in web.config for rewrite
HTML
<configuration>
  <rewriter>
    <rewrite url="^~/offers\/[?](.+)$" to="~/Offers.aspx" />
  </rewriter>
</configuration>

My Original URL: http://localhost/offers
I am going to try with GCLID in URL: http://localhost/offers/?gclid=23948god238492

While trying with this url then web.config file rewrite the url to http://localhost/offers.aspx

Then code changes are:
C#
string strRewriteUrl = Request.RawUrl;
                if (Request.RawUrl.Contains("gclid"))
                {
                    strRewriteUrl = strRewriteUrl.Replace("/?" + Request.QueryString.ToString(), "");
                    Response.Redirect("~" + strRewriteUrl, false);
                }

This code used to remove the gclid query string and redirect to original path
 
Share this answer
 
I found the one solution. i.e. have to rewrite the url in web.config file.

The Code in web.config for rewrite
HTML
<configuration>
  <rewriter>
    <rewrite url="^~/offers\/[?](.+)$" to="~/Offers.aspx" />
  </rewriter>
</configuration>

My Original URL: http://localhost/offers
I am going to try with GCLID in URL: http://localhost/offers/?gclid=23948god238492

While trying with this url then web.config file rewrite the url to http://localhost/offers.aspx

Then code changes are:
C#
string strRewriteUrl = Request.RawUrl;
                if (Request.RawUrl.Contains("gclid"))
                {
                    strRewriteUrl = strRewriteUrl.Replace("/?" + Request.QueryString.ToString(), "");
                    Response.Redirect("~" + strRewriteUrl, false);
                }

This code used to remove the gclid query string and redirect to original path
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900