C# - Is It Possible To Turn Off The Canonical Hostname URL Rewrite Rule From The Codebehind
Sep 27, 2010
I was wondering it is possible to turn off the canonical hostname URL Rewrite rule from the URL Rewrite 2.0 IIS 7.5 Module.
I'm locally developing on a IIS 7.5. The setting of this URL Rewrite rule is set in the web.config.
This is how I deploy: I'm using Webdeploy to publish my web application. The new web.config transforms, which was introduced with VS 2010, is no option for me, because it is bugged:
[URL] and will not be fixed until the release of VS2010 SP1. I'm also not using web deployment projects anymore, because Webdeploy does not seem working with web deployment projects. As a result, I manually switch on the rewrite rule in the web.config before deploying.
If I now want to locally debug something, I manually need to turn off the rule.
Is there a solution like this pseudo-code?
if(Properties.Settings.TurnOffCanonicalHostNameWithLocalHost)
{
URLRewriteModule["CanonicalHostName"].Enabled = false;
}
View 1 Replies
Similar Messages:
Jul 14, 2010
I have create following rule on my local server to check canonical url
<rewrite>
<rules>
<rule name="Enforce canonical hostname" stopProcessing="true">
<match url="(.*)"/>
[Code]....
Its working but i have default.aspx page on which i have taken one link button and written event like this
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Response.Write("Testing Canonical Issue")
End Sub
When i click that linkbutton nothing happens only page get refreshed.
Actually i dont want to display default.aspx page along with my website thats why i have written second rule.
I want domain name with no default.aspx page
if some body writes like this www.abc.com/default.aspx then it must be 301 redirect to www.abc.com
View 1 Replies
Oct 4, 2010
I'm trying to redirect any non-www prefixed traffic to the www prefixed domain. I'm using Umbraco as the CMS and have added the following code into the urlrewritingnet config file:
<add name="nonWWW"
virtualUrl="^(?!www.)(.*)$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="[URL]"
ignoreCase="true" />
I'm getting a "is not a valid virtual path" error
View 1 Replies
Feb 24, 2011
I am getting problem in URL rewrite rules. I am used UrlRewritingNet.UrlRewriter Dll for Url rewriting in asp.net website.I used rules name as "Advanced"& Other rule name as DefaultRule that is used for any user profile page(ie. any user's profile page).When I entered username as "AdvancedMachinesTools". That Rules as below:-
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="Login" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
[code]...
View 2 Replies
Jul 22, 2010
What I want to do it rewrite urls for a bunch of static pages in a locations folder such that
/london
maps to the physical file if it exist in the locations folder eg.
/locations/london.aspx
Is this possible with url rewrite. I can't get the rule to work.
<rule name="Rewrite Locations">
<match url="^([_0-9a-z-]+)/*" />
<conditions>
<add input="/locations/{REQUEST_FILENAME}.aspx" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="/locations/{R:1}.aspx" />
</rule>
View 1 Replies
Mar 3, 2011
I have the following url which i want to write a helicon RewriteRule rule
it should check the pattern startat=/mypage.asp and then only executeOriginal urlhttp://www.test.com/welcome.asp?tartat=/mypage.asp&value1=23&value2=3434&value3=1&value4=someothervaluethe new url http://www.test.com/mynewpage.hcx?startat=/mypage.asp&value1=23&value2=3434&value3=1&value4=someothervalue
View 1 Replies
Nov 30, 2010
Response.RedirectPermanent(Url); can redirect permanently to a url.
However, during my SEO process, I decided to change my routhing rule.
For example,
I change "/tag/{tag}-quotes" routing rule to "quoes-about/{tag}", but I don't want to lose all the traffic to old routing url.
What is the best way to handle this permanent redirection?
View 4 Replies
Feb 10, 2010
i recently installed IIS SEO toolkit on my Windows 7 desktop and tried to run a SEO report for my web site [URL], based on a multi-lingual (greek, english) implementation of asp.net mvc 1. One of the violations reported, has to do with the fact that in my global.asax file, i have the default values "el-GR", "Home" and "Index" for the locale code, controller and action route parameters correspondingly. This way, the [URL] and the [URL] are reported to be acceced from the same url from the SEO toolkit, like shown below:
The page with URL [URL] can also be accessed by using URL [URL].
View 6 Replies
Mar 22, 2011
I want to use canonical url's in my website. I read a few things about it on the internet, but i'm looking for a solution which will automatically generate the canonical for me runtime and add it in the html-code returned to the browser. I've already found an example on the internet using an attribute, but this is not what i'm looking for. Using an attribute i'm still deciding which page should get an canonical or not myself, I want every page to have one generated automatically. I take it there should be (existing) solutions? I'm struggling finding an good example to work on,
View 2 Replies
Jul 19, 2010
I have a website that's in Classic ASP on a hosted server. I'd like to be able to create some "virtual" pages so I can specify google-friendly URLs that translate to ASPs [URL] this_is_the_help_page instead of [URL]admin/helpsubsystem/help.aspx?current_user etc As the server also supports ASP.NET - could I use an HTTP Handler to intercept these calls and do any necessary translations?
View 1 Replies
Feb 12, 2011
When I tested web site on SEO Tools in IIS7 I get this SEO Error: The page contains multiple canonical formats. The page with URL "[URL]" can also be accessed by using URL "[URL]".Search engines identify unique pages by using URLs. When a single page can be accessed by using any one of multiple URLs, a search engine assumes that there are multiple unique pages. Use a single URL to reference a page to prevent dilution of page relevance. You can prevent dilution by following a standard URL format.
Recommended action: Pick a canonical URL format for your site and then ensure that all the links in your site follow that format. (For example, always use lowercase letters.) If an external link that points to your site does not use the canonical URL format, use permanent HTTP redirection to redirect site visitors and search engines to a canonical equivalent of that URL.
I tried to solve this by redirect page to a default.aspx. The problem is that HttpContext.Current.Request.Url.ToString(), always shows [URL] So I can't detect if url typed in browser is only [URL] or [URL] I know that that can be solved in IIS7, but I can't access it to do that in hosting server. Is any solution in ASP.NET to redirect to default page any time when in browser is typed only domain name?
View 2 Replies
Jan 8, 2012
Ok forced to use IIS7.5( begin puke puke puke end) and of course nothing works. Let's take it from start.I created a project and i started IIS7 and created a new website,added the host and checked the security permissions of the folders.I saw most of the features are done automatically so thought this won't work the first time.
I looked at the application pool and changed it to use 32 bit app's (it is a vs2008 app on server 2008 64),i cannot enable isapi but i don't know if it's needed.What else,ehm,checked authentication for anonym also ip address was left to any,ah and changed the port (it's not running on 80) and also checked the binding's set to that port and also used 80 port + myport for a test and also 80 alone just to piss me off more.
Let me state here that the same application works perfect on IIS6 with just using the host i want and my port and of course changing the security.
Also the 2008 log is very useful, showing logs of 3 hours ago. So is it something i must do or the admin messed the dns redirection to this machine.
View 15 Replies
Nov 11, 2010
I get ReffererUrl from current User, if refferer is exists i need to extract hostname without .com/.co.uk .... etc. value from it. So if ReffererUrl is [URL] i want to get just "something".
Doesn't matter whether it is Regex or something else.
View 3 Replies
Mar 21, 2011
we have a INTRANET website that was just created.
The problem is the address is 10.110.96.230:8888
I want it to be easy to access. Something like [URL]
This way I can tell my employees to go to [URL] while on the Intranet.
This would be easier for them to access then remembering the IP address.
View 2 Replies
Nov 29, 2010
I'm learning asp.net mvc 2, it's very excting with me.
I has built a small MVC2 application, it is working fine in built it ASP.net Development Server. However, there're something wrong when have it deployed in IIS 7.5, Window Server 2008 R2 Enterprise. Session is awlays null when I access the application by IE and use hostname to specify the url.
Using IE (IE 7 or IE8) to access my application with link [URL] every working fine
But when I use IE (IE 7 or IE8) to access my application with link [URL] session always null
I'm supprised while FireFox working fine in all cases, both of built in ASP.net Development Server and IIS server, both cases hostname and ip and localhost.
View 4 Replies
Oct 14, 2010
I'm trying to use Response.Redirect(1019characterLongUrl) to redirect the user to another domain.
The URL I use is +1k characters long. This works perfectly in Chrome and Firefox. But as soon as I use Internet Explorer the hostname of the url is exchanged.
If the URL I use looks something like: https://a01-bc-def.com/myDirA/myDirB?myQuery=XYZ... (note that https changes to http)
it would then be malformed in the redirect to http://localhost:9200/bc-def/myDirA/myDirB?myQuery=XYZ... or to
http://localhost:9200/myDirA/myDirB?myQuery=XYZ... (why it changes between the two mentioned formats,
I don't know - but I believe it has something to do with the length of the url I use).
According to several sites found via Google, the maximum allowed length of an URL in IE is 2083 characters. Meaning that my URL should be okay to use. Could it be related to the fact that the URL uses SSL? I've tried sending redirects from HTTP -> HTTPS as well as HTTPS -> HTTPS without any success. If I manually enter the URL it works without any errors.
I've tried using a tinyURL in the redirect but the same error occurs. I've also tried publishing the site to a public server (with and without SSL as mentioned about) but the error remains.
EDIT: I've managed to work around this by using the Refresh meta tag! This feels like a very ugly solution.
View 3 Replies
Jan 8, 2010
I am currently using Visual Studio 2008 on XP Pro SP3. Developing against http://localhost/ everything including debugging works fine.I need a second website on my machine. IIS 5.1 only allows one website at a time so I used the JetStat XP Pro IIS Admin tool to create a second website. This runs by stopping the Default website and starting the other have added the new website name into the Hosts file and mapped to 127.0.0.1.
View 3 Replies
Aug 2, 2010
I have an installer class which I use to do some processing on the application after it is initially installed.
In the installer I have a custom dialog which requests a username and password. This is accessed in my installer class with Me.Context.Parameters("username")
After setting it as CustomActionData /username="[TXTUSERNAME]"
This is all fine. The first dialog of a Web Setup Project gets the user to select an IIS website from a dropdownlist and set a VirtualDirectory if required. I need to get the seleted Hostname but so far I have failed to find a reference to it in any documentation. I have tried things like:
Me.Context.Parameters("targetURL")
Me.Context.Parameters("TARGETSITE")
View 3 Replies
Apr 13, 2010
I developed a website on VS2008, which I then published by right-clicking. I can locally browse that website using[URL]
but when I try giving hostname in place of localhost it fails to resolve. Can this mapping be specified in hosts file?
View 9 Replies
Feb 19, 2011
I have an action for which the output is fairly static, until another action is used to update the datasource for the first action. I use HttpResponse.RemoveOutputCacheItem to remove that action's cached output so that it is refreshed next time the user loads it.Basically I have an action like this:
[OutputCache(Duration=86400, Location=OutputCacheLocation.Server)]
public ActionResult Index()
{
return ...
}
[code]...
View 3 Replies
Oct 25, 2010
In IIS7 I don't find any possibility to keep a website from responding to it's IP address as soon there is SSL set up for this website. I did not add the IP address as hostname for this website and so would expect that the site does only respond to it's given hostname(s). Unfortunately the website won't work if requested via it's IP address, so I have to disable IP address as hostname somehow.
Another issue is that IIS 7 does not display the "secure connection obligatory" error page anymore if secure connection is mandatory for a website. Is there any way to get this error page being displayed, just like it was in IIS6 ?
View 3 Replies
Jan 28, 2012
I'm just trying to teach myself a bit of CSS and it's pretty straight forward but I am getting something odd.
I built a css file, tried out various rules, all good.
Now I edit the css file. Everything compiles ok but it's still using the rules as they were before I edited them. I've even removed some of them from the css file and they're still being used. I tried removing the reference to the css file and the rules all stop being used (as I'd expect) but when I add the reference back in and the old rules reappear but not the new ones.
I'm guessing there's some 'built' version of the css file and that's what's actually being used. But rebuilding the website isn't causing the built css to refresh itself so my edits aren't being picked up.
edit> forget it, I was hitting f5 not ctrl f5. Just a bit of cuture shock switching from desktop dev.
View 1 Replies
Jan 25, 2011
Trying to extract the timezone data from all the time zones using the timezoneinfo class but I have run into a problem. For those timezones that have Daylight savings times I am seeing all kinds of different numbers of adjustmentrules and I have no idea how to determien which rule I shoudl be using for a given timezone. Some have 1 rule, but I see timezones with multiple rules some as high as 11 rules. How do I know which rule I chould be usuing to get the correct DaylightTransitionSart and stop values?
View 2 Replies
May 23, 2010
i have images in left ,right,bottom of the page so i want to draw border like this , in vertical and horizontal,can you give example:
[code]....
View 1 Replies
Mar 17, 2011
Im using Intelligencia UrlRewriter for url rewriting. I have wrote a set of rules in the web.config file I have two sets pages, Static pages whose name is static but content is CMS based Dynamic pages (actually this is not simply a dynamic page its a category which have description and sub categories) Here both pages are being rewritten from the config file. For instance home page, about us page etc tis is being rewritten as
rewrite url="~/Home" to="~/Default.aspx"
The category page is being the same kind of url its being rewritten as
rewrite url="~/(.*)" to="~/GroupHome.aspx?Group=$1"
I have given the rules for the static pages first and then the category url but all the urls are being rewritten to grouphome, even if I have given the rule for home page, about us page etc before the category rule. I have tried even the ollowing still its directing to Group home,
<rewrite url="~/Home" to="~/Default.aspx"/>
<rewrite url="~/(.*)/" to="~/GroupHome.aspx?Group=$1"/>
<rewrite url="~/Home" to="~/Default.aspx"/>
How the rule can be rewritten to include both urls
View 1 Replies