strange #.[some char] added to the page address in firefox - asp.net

[Asp.net website, .net framework 4]
I noticed a strange thing in my web page address, With every new page requested the address of the page automatically attached with somthing like (#.UTedxFc5stU) at the end of the address after loading completed (maybe cause redirect too), this happend with only .net framework 4 applications,
and not happend with my other applications using 3.5 !.
this happend in firefox, chrome only, not with internet explorer.
this an example:
http://egypt.motorsyard.com/cars/used, open it in firefox and you will see somthing like this http://egypt.motorsyard.com/cars/used#.UTehGVc5stU
what is this, and how I stop it ?
Thanks for help.

Check your webconfig for url rewriting code.
i think this is URL redirecting issue.
Edit
If you have characters that look like #.TuomlFaZCSo in the URL those are address bar tracking codes. They provide a way to see how many people visit your site from users copying the URL from the address bar. If you have characters that include the name of a service, like #.TuomlFaZCSo.facebook then those are people returning from a link shared using that service.
To disable them using the client API, do this:
<script type="text/javascript">
var addthis_config = {
data_track_address_bar: false,
data_track_clickback: false
};
</script>
If you want to disable them using the Wordpress plugin look for their respective checkboxes on the Advanced tab of the AddThis plugin settings page.

Related

"http://localhost/" is being automatically added to https urls

As the title suggests, http://localhost/mywebapp is being automatically added to urls within my application.
User clicks an https hyperlink, but instead of browsing to
https://correcturl.something.com
it goes to http://localhost/mywebapp/https://correcturl.something.com
ie the localhost part is being automatically added. I'm sure there is an IIS setting that we are missing here.
It might not be IIS. If you're forming your URLs improperly, I'm pretty sure the browser will handle redirect to "current url" + "redirecting url".
example:
if you execute the following in a javascript console, you will not get redirected.
window.location.href = "/http://google.com";
Running that off stackoverflow page sends me to https://stackoverflow.com/http://google.com
which is incorrect.
I'm assuming that if you're testing urls in some dev environment locally, you'll produce a similar result against localhost. I can't give you a better answer without more information, however I would begin by looking for something in your app similar to what I described.

how to simulate a cross origin site on local machine?

I am trying to simulate a cross origin site. Meaning I shouldn't be able to make ajax request from site A to site B since the browser will not naturally allow me to do so because of their cross-origin policy.
What are the tools I can use in this regard? Or are there any hacks?
What I've tried so far: I've opened a visual studio solution. It has two asp.net web form projects. One web project (say A) simply hosts a form with a file input control and a submit button. The other project B has a simple aspx page, which contains an iframe which loads site A inside of it.
I ran project B, and, in the browser console window, I did something like this:
var ifr = document.getElementById('myiframe');
console.log(ifr.contentWindow.document.body.innerHTML);
The console window displays the markup of site A's page which is loaded in the client's iframe.
Clearly I've failed. But is there I way I can do it on one machine.
Well, a bit of digging shows that you can achieve this feat is by modifying your hosts file (C:\Windows\System32\drivers\etc\hosts) as mentioned in the post below:
How do i map http://localhost:8080 to http://mysites in iis7?

AdBlock blocking CSS and Images on .NET 4.5 web site

I created a new web site using the default web-forms web site template that comes with Visual Studio 2012. Just went to File--> New Website --> C# --> Asp.Net Web Site, and let it create it's basic template.
Then I hit F5 to debug and it runs fine and I get that default welcome page with the aqua green block, etc... but when I add it to IIS and browse to it using localhost/WebsiteName in Chrome, the AdBlock plugin blocks all of the CSS and Images so all I see is black-and white un-styled text. When I disable AdBlock, the styling and images return and it looks normal just like it did when debugging.
I have a feeling it has something to do with the Bundle Referencing, but I'm not sure what's going on.
What specifically is AdBlock blocking?
Why isn't it blocking it when debugging through Visual Studio, only when browsed to it via localhost/WebsiteName?
What can I do to prevent users with AdBlock from having this content blocked when it is clearly not advertising?
I must assume you have a matching rule in your Adblock config. If you Go to Adblock - Options and turn on "I'm an advanced user, show me advanced options." you should then be able to reload your page and go to "Show the resource list" from the Adblock button. All items on the page will be displayed, the blocked items will be in red and the matching filter shown.
Good luck.
Thanks for the tip. It turns out that AdBlock blocks anything matching /advertising/* and the actual name of my app is "Advertising" because it will be an advertiser management system for my organization. Looks like I need to find a new name for that folder. When debugging is only went to localhost:5538/ but localhost/advertising/default.aspx got blocked because of the word "advertising" in the path.

Session variable trounced by Chrome and FF

In my asp.net web application on page load I grab the current page url and store it in a session variable to track which page the user is on so they can return to it if they enter an admin area, do some navigating around etc. They can then click the return button and will be taken to the page they were on before entering the admin.
This all works in IE8; however in FF and Chrome when in the admin the return link redirects to the custom 404 page I have for the web app.
For testing purposes I added the code I wrote below in with my page load event:
Response.Write((string)Session["navurl"]);// displays "http://somedomain.com/customerror/default.aspx"
Session["navurl"] = currentUrl;//ex. currentUrl = "http://somedomain.com/contact/"
Response.Write((string)Session["navurl"]);//ex. currentUrl = "http://somedomain.com/contact/"
Again this works without a problem in IE, but in FF and Chrome on page load the session variable displays the 404 page link and after setting it displays the correct link. I used fiddler to see what was going on and Chrome is throwing a 404 in the GET header for the favicon.ico file, which I am not using in this web app.
I added the faviocon file and the link in the head of the site.master file and Chrome and FF now work fine; I'm still not sure why this is happening. Anyone have an ideas why or how my Session variable is getting overwritten by Chrome or FF?
As a side note I have stepped thru the process debugging and currentUrl is the proper url.
Well, if you are using the .NET handler to serve all pages (ie. all file extensions), then it makes sense that when your browser will make a request for favicon.ico (google to understand what this is), the server fails to find it, and it redirects to a 404. Which in turn modifies the Session variable as "the last page served" : 404.
Now when you render you admin page, and query the Session for "the last page served" what do you get ? "404".
I'd suggest checking the URL to see if it reffers to a user-navigationable page before storing it in session
if (IsAUserPage(currentUrl)
Session["navurl"] = currentUrl;
When you access your admin, are you preserving your session? Using Fiddler have you seen another request for your page? Look for image tags with src="", or iframes.
You must set the Session var on every front end page, but, you never must never set it on the admin pages, only getting to build the "Back" link. If you are using Global.asax events, take care to avoid change the var when serving admin pages.

urlrewriter.net page not executed

I'm having some problems with the module urlrewriter.net for ASP.NET.
I have a multilingual site with a URL like this;
~/home.aspx
To support languages I use this rewrite rule;
<rewrite url="~/de-DE/(.*)" to="~/$1"></rewrite>
Then in my code I get the de-DE part and set the right culture for the current thread. All of this works well.
After I login on the website I get a message "Hello, user x" to show i'm logged in. When navigating to another page, it doesn't display this message anymore and it seems like the page comes from the cache or something with the old (not logged in) data. Also, when I attach the debugger, nothing is executed for this request. If I visit the page like ~/home.aspx instead of ~/de-DE/home.aspx, does problem does not occur.
What could be the problem here?
Thanks
Nevermind!
I had accidently disabled the Check for newer pages in IE8 which caused all of the problems... I'm sorry for the useless question!

Resources