Ask a Question related to ASP.NET Security, Design and Development.
-
Natalia DeBow #1
ASPNET/COM Security E_ACCESS_DENIED error
Hi there,
I am trying to create shortcuts to a desktop and to a Start->Programs menu
from a C# client talking to a server (using .NET Remoting) that in turn
talks to a COM object. I am running both the client and the server code on
the same machine with the client having Administrators privileges. The
server is running under IIS with ASPNET account having Users privileges
only. We do use impersonate = true in our web.config file. I am trying to
create a shortcut for an account that is created on the same machine as the
client and the server. I have also logged in at least once into this
account, so the profile for this account does indeed exist and the password
is set to never expire. This account has Users privileges only.
Here is the function that should create shortcuts, but it chokes when I am
trying to save the .lnk file to a specified folder.
More specifically the line:
hres = ppf->Save(wsz, TRUE);
returns E_ACCESSDENIED and the next line:
hres = ppf->Release();
returns S_FAIL.
The strange thing is when we are trying to created multiple shortcuts for an
app (say, app.exe), the first attempt always fails but consecutive tries
succeed.
Here is the function that creates shortcuts.
BOOL CreateShortcut(LPCSTR lpszFolderName,
LPCSTR lpszProgName,
LPCSTR lpszEXE,
LPCSTR lpszCommand,
LPCSTR lpszWorkingDirectory,
LPCSTR lpszDescription)
{
HRESULT hres;
IShellLink* psl;
char FullPath[MAX_PATH];
CoInitialize(0);
hres = CoCreateInstance(CLSID_ShellLink, 0,
CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
hres = psl->SetPath(lpszEXE);
if (SUCCEEDED(hres))
{
hres = psl->SetArguments(lpszCommand);
if (SUCCEEDED(hres))
{
hres = psl->SetWorkingDirectory(lpszWorkingDirectory);
if (SUCCEEDED(hres))
{
hres = psl->SetDescription(lpszDescription);
if (SUCCEEDED(hres))
{
hres = psl->QueryInterface(IID_IPersistFile, (void**) &ppf);
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH];
sprintf(FullPath,"%s\\%s.lnk", lpszFolderName, lpszProgName);
int nMbwc = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, FullPath, -1, wsz,
MAX_PATH);
hres = ppf->Save(wsz, TRUE);
hres = ppf->Release();
}
}
}
}
}
hres = psl->Release();
}
CoUninitialize();
if FAILED(hres)
SetLastError(hres);
CONFIRM_PROCEED(SUCCEEDED(hres))
BOOL Success = BuildUnInstDB(FullPath);
CONFIRM_PROCEED(Success)
return TRUE;
}
Any help would be greatly appreciated.
Natalia
Natalia DeBow Guest
-
Error: code:Channel.Security.Error string:'Security
Flex 2.0 beta 1 I created an mxml application with the following tag: <mx:WebService id="ws"... -
Security issues with Win2003 and ASPNet app
I have an ASP.NET Web Service and Web Site. It accesses a SQL database for its data and retrieves images from another server. There are 4... -
Server Error in '/' Application ASPNET Error.
Hi Everyone, Just need any insight on this matter. My website works perfectly when intalled on my machine, but once i upload it to the... -
ASPNET Account Security Problem - Running a Web Application over a network share
All, If anyone has been following my trials over the last week see(Setting up a Web Application on IIS 5.1 and ASP.Net Security Problems). I'm... -
Issues in locking down aspnet user security in shared environment
I am trying to lock down file access of some sites in a shared hosting environment so that different users can only access their own site's...



Reply With Quote

