Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC4 ActionLink() generating wrong url
    primarykey
    data
    text
    <p>I deployed an MVC4 application into a WebForms (.NET 4.0) website. </p> <p>Everything seems to be working great except for each <code>Html.ActionLink(...)</code> is generating an incorrect <code>href="#####"</code> link attribute. <br/> <br/> <strong>Problem:</strong><br/> Instead of generating the correct URL (<code>http://child.com/</code>) an incorrect URL is generated: <code>http://child.com/child/</code></p> <p>I used the following <b>.htaccess</b> to "redirect" the user from "domainRoot.com" to domain "domainChild.com:"</p> <pre><code># RewriteEngine On RewriteCond %{HTTP_HOST} salonconnectiondanapoint\.com [NC] RewriteCond %{REQUEST_URI} !salonconnection/ [NC] RewriteRule (.*) /salonconnection/$1 [L,P] # </code></pre> <p><br/> The folder structure is similar to the following:</p> <p><img src="https://i.stack.imgur.com/Ahbns.jpg" alt="enter image description here"></p> <p>I've made no modification to the default routing in my <code>Route.config</code>. </p> <p>Also, I've read this <a href="https://stackoverflow.com/questions/9763486/htaccess-for-subdomain-and-url-rewrite">stackoverflow question/answer</a> describing a similar situation but it didn't provide me with enough to figure it out.</p> <p>Please let me know (in the comments) if you need to see any snippets of code or have questions I can answer to better help us figure this out, thank you.</p> <p>domainChild<b>.com</b> = domain name</p> <p><strong>domainChild</strong> = folder that contains the second project</p> <p>The application needs to start at the containing folder name (<code>domainChild</code>), I'm attempting to do this by setting an IIS "Application Start" in my host's control panel (I've dealt with their support and they referred me to StackOverflow.com... <strong>:/</strong> ...to fix this redirection/url issue) then added the <code>.htaccess</code>. The <code>.htaccess</code> attempt didn't seem to work so I've been trying to throw anything I can at it (see updates below).</p> <p><strong>UPDATE:</strong><br/> I've also attempted to complete the redirect by removing the <code>.htaccess</code> file all together and used multiple variations of the following in the <code>PageLoad</code> event of the parent WebForms Website root domain folder (in-which the MVC project is nested):</p> <pre><code>//string sname = Request.ServerVariables["SERVER_NAME"].ToString().ToUpper(); string sname = Request.ServerVariables["HTTP_HOST"].ToString().ToLower(); if (sname.Contains("domainchild")) { Server.TransferRequest("~/domainChild/"); //Response.Redirect("~/domainChild/"); return; } else { Response.Redirect("Default.aspx"); return; } </code></pre> <p>However the same thing happens ...the <code>url</code> the user is redirected to contains the domainName/containing folder name (e.g., <code>http://domainChild.com/domainChild</code>).</p> <p>This change also appends "<code>Default.aspx</code>" to the end of the <code>URL</code>, it's MVC!?</p> <p>The containing folder name (<code>domainChild</code>) cannot be injected into the <code>URL</code> like this. There has got to be a way to start the application at the containing folder name, replacing the name of the folder "<code>domainChild</code>" with "<code>domainChild.com</code>"</p> <p>I'm lost, please help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload