15,914,419 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by heresanjay01 (Top 6 by date)
heresanjay01
23-Nov-15 0:16am
View
C:\Windows\System32\inetsrv
give full permission to iis user
1-config folder
2-and 3 config file in config folder
heresanjay01
22-Nov-15 23:58pm
View
thanking you sir.
i use this code ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Administration;
using Microsoft.Web.Administration;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
private const string SERVER_IP = "192.168.111.112";// put your ip address
private const int PORT = 80;
private const string WEB_DOMAIN_PATH = @"F:\\web\domains\{0}\";
//Live server
//private const string SERVER_IP = "192.168.111.111";
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request.QueryString["user"]))
{
try
{
string username = Request.QueryString["user"];
string status = CreateUserSite(username, "codeproject.com");//change your Domain id
Response.Write(status);
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
else
{
Response.Write("user parameter not supplied");
}
}
private string CreateUserSite(string user, string domain)
{
string path = string.Format(WEB_DOMAIN_PATH, domain);
string userpath = path + user;
string userUrl = user + "." + domain;
using (ServerManager serverManager = new ServerManager())
{
bool siteExists = false;
int number = serverManager.Sites.Where(p => p.Name.ToLower().Equals(userUrl.ToLower())).Count();
if (number == 0)
{
siteExists = false;
}
else
{
siteExists = true;
}
if (!siteExists)
{
//create user directory
Directory.CreateDirectory(userpath);
//copy every files from a-base to a new created folder
FileInfo[] d = new DirectoryInfo(path + @"\a-base").GetFiles();
foreach (FileInfo fi in d)
{
File.Copy(fi.FullName, userpath + @"\" + fi.Name, true);
}
//create a directory
Directory.CreateDirectory(userpath + @"\swfobject");
FileInfo[] d1 = new DirectoryInfo(path + @"\a-base\swfobject").GetFiles();
foreach (FileInfo fi in d1)
{
File.Copy(fi.FullName, userpath + @"\swfobject\" + fi.Name, true);
}
//create site
Site mySite = serverManager.Sites.Add(userUrl, path + user, PORT);
mySite.ServerAutoStart = true;
mySite.Applications[0].ApplicationPoolName = domain;
//create bindings
mySite.Bindings.Clear();
mySite.Bindings.Add(string.Format("{0}:{2}:{1}", SERVER_IP, userUrl, PORT ), "http");
mySite.Bindings.Add(string.Format("{0}:{2}:www.{1}", SERVER_IP, userUrl, PORT), "http");
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection httpLoggingSection = config.GetSection("system.webServer/httpLogging", userUrl);
httpLoggingSection["dontLog"] = true;
serverManager.CommitChanges();
// ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('" + userUrl + " created');", true);
}
else
{
//ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "error", "alert('user exists. Please use other name');", true);
throw new Exception("user exists. Please use other name");
}
return userUrl + " has been successfully created";
}
}
}
heresanjay01
21-Nov-15 3:51am
View
i try with link but still this link create website but create like sub domain
http://stackoverflow.com/questions/1286831/programatically-create-a-web-site-in-iis-using-c-sharp-and-set-port-number
heresanjay01
9-Oct-13 8:31am
View
Deleted
http://www.beansoftware.com/ASP.NET-Tutorials/Scheduled-Tasks.aspx
heresanjay01
9-Oct-13 8:30am
View
Deleted
sir click here http://www.beansoftware.com/ASP.NET-Tutorials/Scheduled-Tasks.aspx
heresanjay01
8-Oct-13 7:31am
View
i want sand mail delay process and i does't want sand if the mail send using background thread it is possible.
Show More