Click here to Skip to main content
15,905,913 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all,
I have an asp.net application to manage employee details. By clicking one 'publish details' button I want to copy details into sub domain 'employee.domainName.com/employeeName/'. How to setup this sub domain in visual studio and how about URL redirect? Please explain in detail.

Thanks in advance,
Manu v nath
Posted
Comments
Manuel john 11-Jun-13 8:03am    
me to having same problem please help us ......
Manu V Nath 11-Jun-13 8:29am    
Please Let me know if u got any links...
Manuel john 11-Jun-13 8:32am    
check this http://stackoverflow.com/questions/14030896/subdomain-url-redirects-to-the-main-url
Ahmed Bensaid 11-Jun-13 10:03am    
You can't setup the subdomain in visual studio. You need to do that in your web server.
You want a subdomain like that : "employee.domainName.com/employeeName/".
It is impossible because you'll need to create a subdomain on your server for each employee.
I advise you to see in the direction of URL Rewriting instead.

 
Share this answer
 
C#
string metabasePath = "IIS://" + server.ComputerName + "/W3SVC";
DirectoryEntry w3svc = new DirectoryEntry(metabasePath, server.Username, server.Password);

string serverBindings = ":80:" + site.HostName;
string homeDirectory = server.WWWRootPath + "\\" + site.FolderName;


object[] newSite = new object[] { site.Name, new object[] { serverBindings }, homeDirectory };

object websiteId = (object)w3svc.Invoke("CreateNewSite", newSite);

// Returns the Website ID from the Metabase
int id = (int)websiteId;




Regards,
Praveen
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900