How to suspend website for users but left it activated for the developer? - asp.net

I would like to set a page on my website "Coming soon",and open the website when the update is finished.
My website is on host with plesk panel, so I suspended my site and edited the "temporary unavialable service" error page. but now as the developer i cannot check my website( I have to check it on the host and not in the IDE).
What should I do?

Using Url Rewrite you could do a few different things, here are a few of the easier ones:
Redirect by IP. Send everyone that doesn't match your IP address to a maintenance page (make sure you use a 302). If you're on a network where everyone has the same external IP and users on that network are accessing the site, this could be an issue.
Redirect by (lack of) a querystring parameter. This will work if you just need to view and refresh a single page, but if you need to click around through the site it's not going to work.
Redirect by (lack of) a cookie. Have Url Rewrite look for a cookie and if it's not present, redirect to maintenance page. This is probably the best solution of the 3 as it avoids the pitfalls of the other two approaches. The cookie will persist for however long you tell it to so you won't get redirected when you click through as you would with the querystring approach, and the redirects will work for everyone that doesn't have a cookie set- so everybody but you.
There are plenty of examples of all of these approaches on this site and on Webmasters.StackExchange and all over the web that can be found with quick search.

The easiest answer is leave your site up with the home page one of the static pages of your asp.net website and have your page for the site that you are working on called something like home2.aspx. I'm that way people that go to your site without a specific page will get the under construction page and you just need to add the URL of your test page when you deploy

Related

Site only refreshes when adding www. to URL

First time posting so please bear with me.
I'm the unofficial web guy at the company I work for and I helped create our basic static HTML site.
Any work that I do to the site offline and then FTP shows up instantly on my machine. I rarely, if ever, need to clear the cache for changes to show up. However, within the company I work for, nearly half of the users never see the updates. Some do, some don't.
On the machines that don't I've cleared the cache in browser and through the internet control panel settings. Nothing. Still shows the stale content. The only thing that works - and I've seen this both in Chrome and IE is that when I add www in front of the URL is then shows the refreshed site. No big deal, right? Well for users who type in mysite.com without the in front will not see the updates. People who have favorited it like that, will not see the updates.
Now, on to what I've tried to fix it. After much research many people have steered me away from meta tag refresh so I haven't tried that, however, with the help of the IT guy we have, from what we can tell, set the HTTP header of the site to always refresh. This did not do anything for us.
I've tried changing image names in the HTML page when updating a photo and that didn't work either.
I haven't been able to find a .htaccess file so can I create one? If we (IT guy and I) changed the HTTP Header setting to always refresh but there is not .htaccess file will there be no change?
Any help or suggestions would be greatly appreciated.
I have searched on here for the answer and the two most suggested changes are HTTP Header and Meta refresh. HTTP header didn't help and it seems the Meta tag route is bad form.
This is a DNS issue. You need to ask the provider of your web services to add an A or a CNAME record for the domain's root.
If you don't understand the above, just call the provider of your web presence (the company that hosts your web server) and tell them you want yourdomain.com and www.yourdomain.com to go to the same place.

URL routing and permanent page redirection for old page

suppose our company has website which was developed by asp.net web form v1.1. it is running for last 5 year. people search google by keyword and got the link to come to our site...it means google cached all the pages of our site. now our company planing to develop our site with asp.net 4.0 and our company CTO want to use asp.net 4.0 routing feature for search engine friendly. i am aware of how to use url routing feature....here is small sample snippet of url routing.
for our new website pages name will be change. so when some one will search google and get link and when click on those link then request will come to our site but page not found will show because page name will be changed. so how to write the logic in such a way as a result when old request will come then routing will redirect to right page and also do the permanent redirection for google as a result from the next time user will get right page url. so my concern is how to write the logic which will drive the user to right page if the old page does not exist, the user will be redirected to right page using routing. please help me with code & concept. thanks
You need to use a HTTP 301 Permanent Redirection
Using .NET Framework v4:
Response.RedirectPermanent("NewPage.aspx");
EDIT:
I jumped in too quickly there... a good MVC solution would be: http://www.eworldui.net/blog/post/2008/04/25/ASPNET-MVC-Legacy-Url-Routing.aspx
This will redirect the request to the right place and return a 301 back...
If you do it via MVC, you will always have to manage those old routes. I think the best way is tu use directly IIS for this scenario. The url module in IIS allows you to configure permanent redirects very easily.
I am not an expert of MVC, infact a starter, so the solution that comes in my mind is you will have to register all routes for your existing pages like:
routes.MapRoute(
"BooksCategory", // Route name
"products/books.aspx", // URL with parameters
new { controller = "Products", action = "Browse", category = "Books" }
);
You can enhance it according to your needs.
I's suggest using a hybrid of this tools. You should return 301 as it's a permanent move. Google should pick-up on that when it starts scanning your new site.
I'd suggest you also need to keep your legacy urls separate, so they don't interfere with the current site. At some point in the future, perhaps when this new site becomes the legacy site, you'll want to organise your urls. By knowing what's needed by the app & what's for SEO might help.
You can probably do your SEO redirection using IIS and it's redirection module. Also, have look at Googles (and Bings) webmaster tools. They should help you figure our what the search engine is seeing on your site.

How to redirect to the particular web site page in asp.net?

I'm developing one web site. In that web site I'm redirecting control to the another site. After completing work on another web site I want to be back on the my page from the my web site.
Suppose I want to redirect on the my web site page that is "abc.aspx". And I installed my web site on the Default virtual directory of my own pc.
I'm developing one shopping site & for payment I'm redirecting to the ccavenue site. And after completing shopping payment from the ccavenue website I want to redirect to the my shopping web site to the particular page , And I don't want to open the payment process on the another window. Than how to do this?
How to do this?
internal redirect:
Response.redirect("/abc.aspx")
this will do the same but maybe more readable:
Response.redirect(Request.Url.Authority+"/abc.aspx")
external redirect:
Response.redirect("http://www.derp.nu/foo")
Also put FALSE (as a parameter) after the link if you use session variables:
Response.redirect("/abc.aspx", false)
you can also do this:
You'll need that secondary site to perform the redirect. This is typically how ecommerce sites handle their interaction with payment portals. Alternatively, you could open the second site in a new window/tab, so that when the user closes that window, they are returned to your site by default.
Ideally, you need to give more context so people can answer to the particulars of your problem.
I got the solution on this, that is-
System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/CCAvenueReturn.aspx")
which will return me the current url of my web site

Hosting certain pages on a different domain in an iframe produces weird results

Folks,
I am working on an app that hosts certain pages from a different site in an iframe. Because the site is on a different network, I get prompted to log into their network in order to show the pages. All that is fine (the users of this site will be on the same network, so I'm not worrying about their logging in.)
However, on a different page, same app, I'm trying to do the same thing with a different set of pages from that same site. This time, I don't get prompted to log in, but do get the DNS Error page in the iFrame (I'm doing this in IE9, if it matters.) If I click "return to previous page" on the DNS Error page or right-click and click Back, the home page of the app (on the different network) appears in the iframe. After that, trying to load the desired page in the iframe works. But I'm baffled as to why and would prefer it load the first time I try it!
I'm guessing that the conjunction of the hosted pages being secure (HTTPS), their being on a different network, the iframe, and possibly also IE9 are somehow causing this. Anybody have any ideas?
Thanks,
Ann L.
If you go directly to the url that the iframe is pointing at do you get that same error or does it work? And make sure you go to the page the iframe is looking at and not what you think it is looking at. It may be that at some point in your process the page is generating the wrong url for the iframe.
The other thing is that it may be worth using fiddler to check your traffic to see if these other pages are trying to do some kind of redirect on you - they may be checking referrer and not liking connections from outside their network or similar.

capture details from external web page

I'm wondering if it's possible to capture details from the web page that a user previously visited, if my page was not linked from it?
What I am trying to achieve is to allow users to my site to find a page they like while browsing the web, and then navigate to a page on my site via a bookmark, which will add the URL (and possibly some other details like the page title) to a form which they can then submit to my site to add the page to a list of favourites there.
I am not really sure where to start looking for this. I wondered if I could use http referrer, but think this may only work if there is a link to my page?
Alternatively, I am open to other suggestions as to how I could capture this data - a Firefox plugin? A page which users browse other sites in an iframe, with a skinny frame on top?
Thanks in advance for your suggestions.
Features like this are typically not allowed by browsers for security and privacy reasons. The IFrame would work, but this is a common hacking technique so it may be likely to break or be flagged in the future.
The firefox addon is the best solution, but requires users to install it manually.
Also, a bookmarklet could be used. While they are actively on the target page, the bookmarklet could send you the URL.
This example bookmarklet would create a tinyURL for the destination page. You could add it to your database or whatnot.
javascript:void(window.open('http://tinyurl.com/create.php?url='+document.location.href));
If some other site links to yours and the user clicked on that link which took them to your site you can access the "referrer" from the http headers. How you get a hold of the HTTP headers is language / framework specific. In .NET you would use the Request.UrlReferrer; other frameworks would probably handle it differently.
EDIT: After reading your question again, my guess would be what you're looking for is some sort of browser plugin. If I understand correctly, you want to give your clients the ability to bookmark a site, while they are on that site, which would somehow notify your site about the page they're viewing. The cleanest way to achieve this would be a browser plugin. You can also do FRAME tricks, like the Digg bar.

Resources