本文整理汇总了C#中IApplicationHost.GetSiteName方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationHost.GetSiteName方法的具体用法?C# IApplicationHost.GetSiteName怎么用?C# IApplicationHost.GetSiteName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplicationHost
的用法示例。
在下文中一共展示了IApplicationHost.GetSiteName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
bool IServerConfig.GetUncUser(IApplicationHost appHost, VirtualPath path, out string username, out string password)
{
bool flag = false;
username = null;
password = null;
IntPtr zero = IntPtr.Zero;
int cchUserName = 0;
IntPtr bstrPassword = IntPtr.Zero;
int cchPassword = 0;
try
{
if (UnsafeIISMethods.MgdGetVrPathCreds(IntPtr.Zero, appHost.GetSiteName(), path.VirtualPathString, out zero, out cchUserName, out bstrPassword, out cchPassword) == 0)
{
username = (cchUserName > 0) ? StringUtil.StringFromWCharPtr(zero, cchUserName) : null;
password = (cchPassword > 0) ? StringUtil.StringFromWCharPtr(bstrPassword, cchPassword) : null;
flag = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password);
}
}
finally
{
if (zero != IntPtr.Zero)
{
Marshal.FreeBSTR(zero);
}
if (bstrPassword != IntPtr.Zero)
{
Marshal.FreeBSTR(bstrPassword);
}
}
return flag;
}
示例2: InvalidOperationException
// if appHost is null, we use the site name for the current application
string IServerConfig.MapPath(IApplicationHost appHost, VirtualPath path) {
string siteName = (appHost == null) ? _siteNameForCurrentApplication : appHost.GetSiteName();
string physicalPath = ProcessHostConfigUtils.MapPathActual(siteName, path);
if (FileUtil.IsSuspiciousPhysicalPath(physicalPath)) {
throw new InvalidOperationException(SR.GetString(SR.Cannot_map_path, path.VirtualPathString));
}
return physicalPath;
}
示例3: CreateObject
public IRegisteredObject CreateObject(IApplicationHost appHost, Type type)
{
if (appHost == null)
throw new ArgumentNullException("appHost");
if (type == null)
throw new ArgumentNullException("type");
string appId = CreateSimpleAppId(VirtualPath.Create(appHost.GetVirtualPath()), appHost.GetPhysicalPath(), appHost.GetSiteName());
return CreateObjectInternal(appId, type, appHost, false);
}
示例4: CreateSimpleAppID
private string CreateSimpleAppID(IApplicationHost appHost)
{
if (appHost == null)
{
throw new ArgumentNullException("appHost");
}
return this.CreateSimpleAppID(VirtualPath.Create(appHost.GetVirtualPath()), appHost.GetPhysicalPath(), appHost.GetSiteName());
}
示例5:
bool IServerConfig.GetUncUser(IApplicationHost appHost, VirtualPath path, out string username, out string password) {
bool foundCreds = false;
username = null;
password = null;
IntPtr pBstrUserName = IntPtr.Zero;
int cBstrUserName = 0;
IntPtr pBstrPassword = IntPtr.Zero;
int cBstrPassword = 0;
try {
int result = UnsafeIISMethods.MgdGetVrPathCreds( IntPtr.Zero,
appHost.GetSiteName(),
path.VirtualPathString,
out pBstrUserName,
out cBstrUserName,
out pBstrPassword,
out cBstrPassword);
if (result == 0) {
username = (cBstrUserName > 0) ? StringUtil.StringFromWCharPtr(pBstrUserName, cBstrUserName) : null;
password = (cBstrPassword > 0) ? StringUtil.StringFromWCharPtr(pBstrPassword, cBstrPassword) : null;
foundCreds = (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password));
}
}
finally {
if (pBstrUserName != IntPtr.Zero) {
Marshal.FreeBSTR(pBstrUserName);
}
if (pBstrPassword != IntPtr.Zero) {
Marshal.FreeBSTR(pBstrPassword);
}
}
return foundCreds;
}
示例6: InvalidOperationException
string IServerConfig.MapPath(IApplicationHost appHost, VirtualPath path)
{
string siteName = (appHost == null) ? this.CurrentAppSiteName : appHost.GetSiteName();
string physicalPath = this._nativeConfig.MapPathDirect(siteName, path);
if (FileUtil.IsSuspiciousPhysicalPath(physicalPath))
{
throw new InvalidOperationException(System.Web.SR.GetString("Cannot_map_path", new object[] { path.VirtualPathString }));
}
return physicalPath;
}