Microsoft.Web.Administration.Application.Load C# (CSharp) Méthode

Load() private méthode

private Load ( string path, string physicalPath ) : void
path string
physicalPath string
Résultat void
        internal void Load(string path, string physicalPath)
        {
            VirtualDirectories.Add(
                new VirtualDirectory(null, VirtualDirectories) { Path = path, PhysicalPath = physicalPath });
        }
    }

Usage Example

        private async void btnOK_Click(object sender, EventArgs e)
        {
            foreach (var ch in ApplicationCollection.InvalidApplicationPathCharacters())
            {
                if (txtAlias.Text.Contains(ch.ToString(CultureInfo.InvariantCulture)))
                {
                    MessageBox.Show("The application path cannot contain the following characters: \\, ?, ;, :, @, &, =, +, $, ,, |, \", <, >, *.", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            foreach (var ch in SiteCollection.InvalidSiteNameCharactersJexus())
            {
                if (txtAlias.Text.Contains(ch.ToString(CultureInfo.InvariantCulture)))
                {
                    MessageBox.Show("The site name cannot contain the following characters: ' '.", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            if (!await _site.Server.VerifyAsync(txtPhysicalPath.Text))
            {
                MessageBox.Show("The specified directory does not exist on the server.", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (Application == null)
            {
                Application = new Application(_site.Applications)
                {
                    Name = txtAlias.Text,
                    ApplicationPoolName = txtPool.Text
                };
                Application.Path = string.Format("{0}/{1}", _parentPath.TrimEnd('/'), Application.Name);
                Application.Load(Application.Path, txtPhysicalPath.Text);
                Application.Parent.Add(Application);
            }
            else
            {
                foreach (VirtualDirectory directory in Application.VirtualDirectories)
                {
                    if (directory.Path == Application.Path)
                    {
                        directory.PhysicalPath = txtPhysicalPath.Text;
                    }
                }
            }

            DialogResult = DialogResult.OK;
        }
All Usage Examples Of Microsoft.Web.Administration.Application::Load