3
Locally my site has the following default route is everything works:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Projeto.WEB.Celular
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Home",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
But my site is not in the root folder of the server, I have a virtual folder with the name website, getting like this:
http://www.teste.com.br/website
This way when I am going to make an access to a page the redirect keeps pointing to the root folder, and should come the name of the folder before:
http://www.sistemaguardiao.com.br/"folder is missing"/Recover password
Example:
@model Generico.Dominio.TB_USUARIO
@{
ViewBag.Title = "Index";
}
@Html.Partial("_navbarPrincipal")
@Html.Partial("_PartialMensagens")
<div class="container droppedHover">
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
@Html.ValidationSummary(true)
<div class="row">
<div class="span6">
@Html.TextBoxFor(x => x.login, new { placeholder = "endereço de e-mail", @class = "form-control input-lg "})
@Html.ValidationMessageFor(x => x.login)
@Html.TextBoxFor(x => x.senha, new { placeholder = "password", @class = "form-control input-lg", type = "password" })
@Html.ValidationMessageFor(x => x.senha)
</div>
</div>
<br />
<div class="row">
<div class="span6">
<button class="btn btn-lg btn-block btn-primary glyphicon glyphicon-log-in" type="submit" name="opcao" value="pesquisar" > Login...</button>
<a href="@Url.Action("Index", "RecuperaSenha")" class="btn btn-lg btn-block btn-warning ">
Recuperar Senha
</a>
</div>
</div>
}
</div>
web confing:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<connectionStrings>
<add name="Conexao"
connectionString="Server=PC-ESTUDO\SQLEXPRESS;Database=teste;User Id=teste;Password=123;"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
</compilers>
</system.codedom>
</configuration>
thanks for the help
How you are doing to create the links in your Views?
– Leonel Sanches da Silva
@Ciganomorrisonmendez, I added in the question the login page, see the link that calls the Recoverpassword, in this case already comes without the folder "website"
– Harry
What about hosting? How is it done? On IIS or a dedicated website service?
– Leonel Sanches da Silva
dedicated service, like in my example : http://www.teste.com.br/website
– Harry
I can give you an answer, but you’d have to have access to
web.config
from the top directory.– Leonel Sanches da Silva
@Ciganomorrisonmendez, Ok, you can access, web.config from the top directory would be what’s inside the Views folder or what’s outside?
– Harry
The root directory.
– Leonel Sanches da Silva
There are 2 web config, one inside the project just above Global.asax and the other that is just below, which one needs?
– Harry
The web.config just below.
– Leonel Sanches da Silva
added to the question
– Harry