|
Hello
i do something like this:
public static bool CreateNewWebsite(WebSiteInfo WebsiteInformation)
{
string strIISPath = WebSiteInfo.IIS + WebsiteInformation.ServerName + WebSiteInfo.WEBSERVICE;
// Check if path points to any existing directory
if (DirectoryEntry.Exists(strIISPath))
{
///and here comes exception
--
The system cannot find the path specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The system cannot find the path specified.
--
While debuging i found out that exception is here:
DirectoryEntry.Exists(strIISPath)
but strIISPath is right("IIS://server_name/W3SVC"),so,cant find the reason of the problem
thnx
|
|
|
|
|
DimaPursanov wrote: but strIISPath is right("IIS://server_name/W3SVC"),
it should be
"IIS://"+this._strServerName+"/W3SVC/1/Root"
This will work !!!!
if any prob then inform me.....
-------
|
|
|
|
|
public string CreateVDir()
{
System.DirectoryServices.DirectoryEntry oDE;
System.DirectoryServices.DirectoryEntries oDC;
System.DirectoryServices.DirectoryEntry oVirDir;
try
{
//check whether to create FTP or Web IIS Virtual Directory
if (this._strDirectoryType == VDirType.WEB_IIS_DIR)
{
oDE = new DirectoryEntry("IIS://"+this._strServerName+"/W3SVC/1/Root");
}
//Get Default Web Site
oDC = oDE.Children;
//Add row
oVirDir = oDC.Add(this._strVDirName, oDE.SchemaClassName.ToString());
//Commit changes for Schema class File
oVirDir.CommitChanges();
//Ask if Virtual Directory Exist
if(Directory.Exists(this._strPhysicalPath))
{
Console.WriteLine("Error");
}
//Create physical path if it does not exists
if (!Directory.Exists(this._strPhysicalPath))
{
Directory.CreateDirectory(this._strPhysicalPath);
}
//Set virtual directory to physical path
oVirDir.Properties["Path"].Value = this._strPhysicalPath;
//Set properties
oVirDir.Properties["AccessRead"][0] = true;
oVirDir.Properties["AccessWrite"][0] = true;
oVirDir.Properties["AccessExecute"][0] = true;
oVirDir.Properties["EnableDirBrowsing"][0] = true;
oVirDir.Properties["EnableDefaultDoc"][0] = true;
oVirDir.Properties["DefaultDoc"][0] = "default.aspx";
oVirDir.Properties["AuthAnonymous"][0] = false;
oVirDir.Properties["AuthBasic"][0] = false;
oVirDir.Properties["AuthNTLM"][0] = true;
//Create Application for IIS Application (as for ASP.NET)
if (this._strDirectoryType == VDirType.WEB_IIS_DIR)
{
oVirDir.Invoke("AppCreate", true);
oVirDir.Properties["AppFriendlyName"][0] = this._strVDirName;
}
//Save all the changes
oVirDir.CommitChanges();
return "Virtual Directory created sucessfully";
}
catch (Exception exc)
{
return exc.Message.ToString();
}
}
U can use this one also....
|
|
|
|
|
Abhijit Jana,thank you very much for your answer!
but now exception is here:
oDE = new DirectoryEntry("IIS://" + ConfigurationManager.AppSettings["ServerName"].ToString() + "/W3SVC/1/Root");
//Get Default Web Site
oDC = oDE.Children;
//Add row
oVirDir = oDC.Add(WebsiteInformation.SiteName, oDE.SchemaClassName.ToString());
..exception is the same..
|
|
|
|
|
how to pass a link through gridview using linkbutton or onclick event..pls help me out.
alok2171
|
|
|
|
|
How to Identify the Modified values in Dataset?
---
Regards
ilango gandhi
' Knowledge can only be got in one way, the way of experience; there is no other way to know.'
|
|
|
|
|
Check the RowState property of each rows...
if(row.RowState == DataRowState.Modified)
{
}else{
}
...or get a DataView for the modified rows:
DataView view = new DataView(dataTable, filter, fieldName, DataViewRowState.ModifiedCurrent);
____________________________________
There is no proof for this sentence.
|
|
|
|
|
Is there any completed documentation to check if I wanna know all new features of C# 3.0? I read C# specification a lit bit but it seems it covered all features of C# (not just only C# 3.0 )....
Any idea would be appreciated. Thanks in advance.
|
|
|
|
|
|
Thanks. I will take a look... I wonder how come MS doesn't have the full documentation for new changes..
|
|
|
|
|
on loading xml string in xmldocument it gives error illegal characters in path even if i give sinfle mode in it like
Can any body tell me the reason
Its urgent !!!
Thanks in advance....
Gaurav
|
|
|
|
|
check encoding of your XML Doc
|
|
|
|
|
I can get the handle of the window, it's another application. I want to send a "Ctrl+C" to the window.
I think I should use the windows message system. But I don't know how to do.
Thanks in advance.
|
|
|
|
|
pinvoke SendMessage
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
try to download and install API-Guide
this software will help u lot.
|
|
|
|
|
Hello, please can anyone here show me how to design a program which will capture infrared signals from a remote control so that they can either be analysed or retransmitted. can this be done with c#?
Emotu
|
|
|
|
|
Try this [^] link.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
thanks a lot, I'll take a look at it. looks like it may help me out.
|
|
|
|
|
Check out the Lirc and/or WinLirc projects; they should give you some inspiration.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I want to design a program which can change wallpaper dynamic,but I do not know how to place the wallpaper on the center of desktop.
Thanks for your help!
|
|
|
|
|
Why don't you use Google. It's that difficult? A simple search and I already found 2 articles:
1. blogs.msdn.com
2. CodeProject
3. Google
First search on the Internet and then come here when you have problems.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
|
Does anyone know any code that will bring up the start menu, for say, if a button is pressed? Thanks.
The most knowledge doesn't mean the most wise...
|
|
|
|
|
On button click Generate the "Win" key event of Keyboard.
|
|
|
|
|
I want to update webconfig file in a system or in winform using c#.
I have a web application and system application but i want the system application updates the databasename, username and password.
I tried this one:
Configuration config = WebConfigurationManager.OpenWebConfiguration("~\\DataMaintenance\\Web.Config");
but its not work
******************************
I just want to
know everything
|
|
|
|