I got project that runs on main ftp directory copy all the files to new directory in the ftp with name "new" And now i have a problem its no reconized the master page in all the aspx files because the path is ~/templ.master And if i change it to ~/new/templ.master
Its working good but i have a lot of files and codebehind (vb files) too that not reconized
So i ask for a way to change the main website directory on my project That the project will take all the files from new dir...
How to do it? Tnx a lot
edit:
again thats my files:
new/templ.Master
new/templ.Master.designer.vb
new/templ.Master.vb
new/default.aspx
in new/templ.Master there is a line like this:
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="templ.master.vb" Inherits="WebApplication1.templ" %>
in new/default.aspx there is a line like this:
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/templ.Master" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
when i change in the default.aspx to line:
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/new/templ.Master" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
its working but its not read the CodeBehind="templ.master.vb" its take the file templ.master.vb from the root not from the new directory...
and like i said i have a lot of aspx files so i cant change all MasterPageFile="~/templ.Master" to MasterPageFile="~/new/templ.Master" ... i search a short way to do it...
Set the website directory as main folder of the website and change the default mainpage in web.config as below: Web.config
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="~/templ.master"/>
</files>
</defaultDocument>
</system.webServer>
try to add this to web.config:
<system.webServer>
<rewrite>
<rules>
<rule name="redirect" stopProcessing="true">
<match url="^$" />
<action type="RedirectToSubdir" url="/new" />
</rule>
</rules>
</rewrite>
</system.webServer>
If it doesn't work, do a manual process: Juts replace "MasterPageFile="
with MasterPageFile="~/new/
by hit CTRl+H in visual studio (select Match case
and apply that for current project
). Do a same thing for CodeBehind="
etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.