MVC :: How To Redirect Actions, That Require Https To A Certain Subdomain

Mar 16, 2011

I am new to asp.net and mvc 3. Currently I am experimenting with https. I use mvc 3, iis 7 and visual studio 2010 under windows 7.

The problem that I want to solve is the following.

The SignUp action should only be accessible via https.

My SSL certificate is issued only for a certain subdomain: secure.mydomain.com

The goal is that all requests to SignUp are redirected to secure.mydomain.com/SignUp such that the certificate fits to the domain.

Requests not using https simply should use mydomain.com.

I successfully installed the certificate to my local iis 7, and when I use the [RequireHttps] attribute, the connection is protected with this certificate.

My questions are:

How can I do the redirects right?

Is there a possibility to test this on my local machine where all request go to localhost?

View 6 Replies


Similar Messages:

MVC :: Child Actions Are Not Allowed To Perform Redirect Actions

Jun 29, 2010

I am getting an exception that child actions are not allowed to perform redirect actions. Although I can understand that this might is true in most situations I do believe that the framework might allow this to pass when a Child Action is calling another child action like in this example:

I have this code in my CountryController (I compacted it a bit but the main concept remains that I have a controller with Child Actions only):

[Code]....

This exception is being thrown:

Server Error in '/' Application.

Child actions are not allowed to perform redirect actions. Description:An unhandled exception occurred during the execution of the current web request. Review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Child actions are not allowed to perform redirect actions.

View 4 Replies

Redirect Subdomain To Subfolder Of Another Subdomain?

Nov 15, 2010

What I want to do is take traffic that is going to shop.mywebsite.com and redirect or rewrite (I'm not sure of the terminology) the domain to be www.mywebsite.com/shop. Both shop.* and www.* are separate web applications (nopCommerce and Umbraco respectively) that don't seem to cooperate when I've tried to nest them. Both applications are in a Server 2008 R2/IIS 7.5 environment.

I've searched around stackoverflow and what I've found is a lot of answers to mapping the other direction (ie subfolder to a subdomain) but that's not what I'm looking for as far as I understand the problem.

The end goal is to combine the SEO reputation of the shop subdomain into the www subdomain. I readily admit that I might have this all backwards and am willing to try any suggestions I'm offered.

View 1 Replies

Security :: Require Https To Safeguard Windows Authentication Credentials?

Nov 9, 2010

I have a zealous network administrator who insists that we must use https on an intranet web application in order to safeguard user's credentials. The app is an asp.net web app that uses Windows Authentication to automatically identify users and log them in. There is no login dialog and user's never enter their login or password. The application does not process any confidential data, and the only rationale for requiring https is to "safeguard" users credentials. Additionally he stated that ntlm can be easily hacked.I responded with some information from an MS white paper on Windows Authentication that said it was the recommended way of authenticating users, and that user's credentials were safe because their passwords are not transmitted across the network when the application authenticates them since it sends a hash of the password.

View 1 Replies

301 Redirect For An Entire Subdomain?

Nov 7, 2010

I want to wipe a subdomain off the face of the internet.

So any page in the sitemap I want it to 301 redirect over to the homepage of the main www site...

Can that be done? I tried setting the re-direct in IIS, but it only worked if I hit the homepage (the subpages all 404d)

View 1 Replies

Configuration :: How To Redirect To Another Url After SubDomain Does Not Exist

Sep 29, 2010

how can i redirect to another url when SubDomain does not exist?

like:
NotExist.MyDomain.com -> www.MyDomain.com/NotExist

I'm running on:
Windows 2003 Server
Plesk Control Panell 9.5
.Net Framework 4.0
And No Access IIS

View 2 Replies

Simplest Way To Redirect A Web Request To An .NET Application To A Subdomain

Jun 5, 2010

What is the simplest way to redirect a web request to an ASP.NET application to a subdomain?If a request comes into the URL http://somesite.com/foo.aspx, the new destination URL should behttp://www.somesite.com/foo.aspx or http://blog.somesite.com/foo.aspxHow can you programmatically redirect the request to the subdomain, keeping the rest of the URL intact?

View 2 Replies

Security :: Forms Authentication Across A Subdomain And The Redirect URL Failure?

Apr 9, 2010

Here's my scenario.

I've got a site called domain.com and also another product on product.domain.com. The product.domain.com requires authentication to access it. For consistancy in the user experience I have set the login url in the web.config on product.domain.com to be http://domain.com/Login.aspx. This redirection is working ok - and a sample url would be:

http://domain.com/Login.aspx?RedirectURL=/default.aspx

The problem is that the RedirectURL does not take into account that the request originally came from product.domain.com so when the authentication is successful the user is not redirected back to product.domain.com

I have come up with a solution for this but would like feedback if possible.

I changed the loginURL in the web.config to http://domain.com/Login.aspx?domain=product.domain.com so the sample url is now:

http://domain.com/Login.aspx?domain=product.domain.com&ReturnURL=Default.aspx

I then override the LoggedIn event in the membership control and check to see if the domain value pair is specified and if it is I redirect to the domain + ReturnURL.

As I said previously i'd appreciate any comments or other ways to achieve the same result.

View 1 Replies

How To Redirect Http To Https

Feb 9, 2010

I want to redirect http to https. I tried this one,but I have one problem, I have to redirect to another page. The request.url gives the current page, whereas I need to redirect to another page. How do I do that.

if(!Request.IsSecureConnection)
{
string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(redirectUrl);
}

View 2 Replies

Redirect To Https Login Page

Jun 9, 2010

I have a site that has a mix of http and https pages. Under the root of the site, one folder has all the http pages and another has all the https pages. Login is over https and sends the user to the other pages. When a session expires the forms authentication redirects to the Login page but the browser uses http and the user gets a 403 error. Is there any way to override the session timeout to send it to https?

View 1 Replies

Web Forms :: How To Do HTTPS Redirect In Website

May 7, 2015

I purchased a certificate from my hosting provider from my web site. There was some confusion as to whether I needed to use IIS to install it or if they would. After a few days and several phone calls they said they had it installed and configured, but when I tried to set up rewrite rules in web.config the site would not load. When I point my browser to https:mydomain it would load, but there was not green lock in the address bar and 'HTTPS' was not green. I contacted them again and after explaining the situation and being put on hold for 45 minutes I hung up. This morning the the site is working and HTTPS appears to be configured correctly.

I could find no changes to web.config on redirection, so how is it being redirected to HTTPS? I'm concerned that when I post changes to the site I could wipe out what ever they did to get it to work with HTTPS. Could changes been made 'above' my site on the server that I can't affect? Should I be concerned?

View 1 Replies

Web Forms :: SSL: Http To Https Redirect Loop?

May 3, 2010

I'm having real trouble redirecting pages from http to https on my live website. Everything is fine on my IDE but as soon as I upload it to my shared web host (123-reg.co.uk) I hit a problem. When I try to redirect to https using Response.Redirect it seems a loop occurs and the request is never carried out.

The code I've tried:

[Code]....

and

[Code]....

Both above methods worked fine in my IDE but not on my live system.

In IE nothing happens but in Firefox the below error is displayed:

"Firefox has detected that the server is redirecting the request for this address in a way that will never complete. "

View 9 Replies

Security :: Automatically Redirect To HTTPS And Check If SSL Is Active?

Aug 20, 2010

I've set in the web.config:

[Code]....

This works fine. If there is no ssl connection, the login form doesn't continue. But I would like to check if ssl is active (in codebehind) and, if it's possible, to automatically the user to the https page if he's currently on http. (I could do this job by manually redirect with page.response("https://url... login.aspx"); but this is not really generic. For example if the webapp is moved to another domain it doesn't work anymore... I'm looking for something like: FormsAuthentication.RedirectWithSSL();

View 2 Replies

Subdomain Cookie (parent And One Subdomain)

Jan 31, 2010

I have an app with multiple subdomains, subone.parent.com, subtwo.parent.com.

I have a logon page at parent.com/login. When a user logs in I redirect them to the proper domain based on which one they are a member of. This works fine.

FormsAuthenticationTicket ticket = new FormsAuth...
string encTicket = FormsAuthentication.Encrypt(ticket);
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
cookie.Domain = subone.parent.com
Repsonse.Cookies.Add(cookie)

This properly authenticates the user for subone.parent.com and not subtwo.parent.com. However I would like to do the following.

If the user goes back to parent.com, I would like to know that they are logged in and redirect them back to subone.parent.com.

Is there a best practice for accomplishing this? Or do I have to set another cookie for parent.com?

I'm working in asp.net mvc if it matters.

View 3 Replies

HTTPS ASPX Page Redirect To HTML Page Logs User Out - As If Session Lost?

Sep 10, 2010

Building asp.C# shopping app that is using a hosted payment page to process payments (using posting of data to a hosted payment page). SSL certificate is signed and installed.

Flow:

Prelim) (HTTPS) Users authenticate using asp Login control

1) Users add items to cart.

2) (HTTPS)Users go to checkout page.

3) Users finalize their order, then click pay now after agreeing to T&C.

4) Server gets cart data (from MSSQL2005) and sets a transaction cookie (expiry set to 20 mins).

5) (HTTPS) Server Response.Redirects to an html page (in the same folder as the login protected pages).

6) Html page reads transaction cookie data and generates form fields.

7) (HTTPS) Html page posts data to hosted payment page (php).

8) User enters payment info and clicks pay now.

9) (HTTPS) hosted payment page posts info back to a .aspx page that checks if payment OK.

10a) If payment !OK, redirects to a declined page.

10b) (HTTPS) If payment OK, sets a verification cookie (expiry set to 20 mins). Then redirects to another html page.

11) Html page reads cookie data and generates form fields.

12) (HTTPS) Html page posts data to hosted verification page (php).

13) Verification page verifies (of course), if transaction ok.

14) (HTTPS) verification page posts data to a .aspx page that checks if verification OK.

15) If verification OK, process orders and do receipt stuff.

Issue:

This control flow was tested on an unsigned dev environment. SSL was being enforced, if needed on the unsigned SSL certificate. So we'd get prompts that certificate may be bad, but the control flow worked seamlessly.

However, now live with a signed SSL certificate, going from step 5 to 6, we are encountering a situation where some users (not duplicated every time, but verified that it does occur) when they click pay now and are redirected to the html page, they are forced back to the ~/login.aspx page (as if they were logged out).

Things to note:

a) The session did not time out.

b) The browsers have cookies and javascript enabled.

c) I can process the entire flow seamlessly on the same machine with other accounts, and occasionally, the same account.

So, basically, I'm stumped... Is this a viewstate error? A login control bug that won't let me redirect to an html page because it is now using a real SSL? Anyone have any experience with this kind of deal? I'm at a loss for solutions at this point.

View 1 Replies

HttpHandlers / Modules :: Redirect A Page From Http To Https Using Http Module Begin Request Handler?

Jul 15, 2010

i redirect a page from http to https using http module begin request handler .i am calling webservice using ajax but it is saying webserice not defined .which otherwise works fineits work fine when rediect page in page_load instead .but i need to add function for https to http in every page. i still not know why ajax is not working when i use http module for redirect

View 3 Replies

User Controls :: Redirect User To HTTPS (Secured) Connection If HTTP (Unsecure) Connection Is Detected

Mar 12, 2013

I have got ssl security for my website.I have written onLoad that [URL] ... Should redirect on [URL] ... it redirects but first the [URL] ....pages loads full and then after a sec it redirects...I want to solve this

function(){
windows.onload = windows.location.href("https://mylifeshades.com")
}

View 1 Replies

How To Set Properties That Are Available In Actions

Jan 21, 2011

In my actions, I want to pre-load the User object and set some other properties, all BEFORE the action loads. I know there are events where I can do this, but how will these objects that I set be made available in my controller's actions once the filter fires and execution is now at the action level?

example:

public actionresult SomeAction()
{
string username = this.CurrentUser.username;
}

View 1 Replies

MVC :: Distinguish Between Those Actions?

Jun 26, 2010

View on a button I have many different actions. So how to align them with the corresponding action in the controller. Means I want to know how many actions a View.For example, in the registration page.I have a button-Register and Login button. In the controller I have a registration action, an action Login. So how can I distinguish between those actions.

View 1 Replies

Object Require In JavaScript?

Jul 15, 2010

Am using java script in asp.net for input validation. When i run the below program it was throwing an exception Object expected. Please advice me where it was going wrong. i have attached the full code for your reference.

[Code]...

1. Use the ID that is generated by the .NET runtime. This isn't the best approach: if the structure of your page changes over time, the ID may also change.

2. Use this in your javascript code:

if(document.getElementById('<%=TextBox1.ClientID%>').value=="")

View 3 Replies

.NET MVC Actions With Optional Parameters

Feb 1, 2010

I have an MVC action on my abstract BaseControlller like this (and this action is common across all inheriting controllers):

//
// GET: /controller/RenderForm/{formType}
[Authorize(Roles = "Administrators")]
public ActionResult RenderForm(FormType formType, BaseContentObject contentObject)
[code]...

View 1 Replies

MVC :: How To Pass Data Between Actions

Aug 10, 2010

I am set up a series of pages like so...Page 1: User is presented a series of checkboxes. Each checkbox represents a group.<User makes selection and submits form, Controller validates input and send selected list to next action>Page 2: User is presented a series of checkboxes of items within the groups he/she selected in step 1.<User makes selection and submits form, Controller validates input and send selected list to next action>

View 2 Replies

C# - What's The Best Way To Handle Multiple Actions

Jun 1, 2010

Like most web applications you have a method that gets called when you log in. There are a few things that may need to get done when logged in and over time this may increase. eg. logging, welcome emails, maintenance. Should events be used to do this or is there a better way?? I'm using C# and ASP.net MVC. Update This is already in its on Service Layer class. eg.

public void Login(User user)
{
SetAuthCookie(user);
LogLogin(user, true);
SendEmails();
}

View 3 Replies

MVC :: 3 Moving Between Controler Actions?

Nov 28, 2010

Is there a way to easily passed around an ID between controller actions on the same controller?I.E. I have an Index action which takes an ID parameter, and when a user creates a new post I would like them to go back to the index page with the same ID.Currently I am just passing it around in my view model, but it seems real cumbersome and I was wondering if there was a better way to do this?

View 1 Replies

Point Actions To The Same View?

Feb 3, 2010

I have a controller with the following actions...

public ActionResult YellowList()
public ActionResult RedList()
public ActionResult BlueList()

All these actions populate the same viewModel (ListViewModel).

How do I get them all to point to the same view (aspx)?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved