How to redirect to the particular web site page in asp.net? - 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

Related

How to enable redirect in Drupal 9 on launch of application

I have enabled Keycloak authentication in a website built with Drupal. As soon as I launch the website I want to redirect to Keycloak's login page if the user is not signed in.
Is there any way to achieve this as soon as I open the website
I tried making the default front page of Drupal website as localhost:8080 (which is where Keycloak's login page is present) but was unable to do it.
If you are experienced with writing custom modules, you can write your own implementation of event subscriber. Here is a good example of it:
https://drupal.stackexchange.com/a/223109/5644
If not, then I recommend the module https://www.drupal.org/project/redirect - I am not 100 per cent sure if it lets you to specify redirect only for anonymous but it is definitely worth trying.
I am assuming that the integration with the Keycloak service is working and out of scope of this question.

Custom login / redirect from WordPress website

I am looking to find a way for customers to log in to their customer account hosted at an external site but to be able to sign up and log in from our customer WordPress website.
e.g. Tom signs into his account using a login box at www.abc123.co.uk
He is then redirected to his customer account panel hosted at www.def456.co.uk
I need customers to be able to do this, as opposed to logging into WordPress site and being taken to a page within the WordPress site.
Is it possible using SSO maybe? I hope someone can help me with solid advice on this.
Many thanks,
Richard.
You can use Login redirect plugin for custom redirect after login.
you can download from: https://wordpress.org/plugins/woo-login-redirect/

Landing page for SilverStripe Website

I have a SilverStripe blog website set up on my domain and hosting. However, for now when people visit my URL I want them to come to a landing coming soon page as I want to do some marketing and create a small database of users prior to launch.
How can I do this without having to remove the SilverStripe Project from the hosting?
I thought it may be as simple as adding a new index.php page. However, even with this it comes straight into my blog website rather than the landing page I made.
One way to do this is by using this SilverStripe Maintenance Mode Module.
This module allows an administrator to put site in offline mode with 503 status to display a 'Coming Soon', 'Under Construction' or 'Down for Maintenance' Page to regular visitors, whilst allowing a logged in admin user to browse and make changes to the site.
You can customise the maintenance page to say whatever you like.

How to suspend website for users but left it activated for the developer?

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

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.

Resources