Noverant Releases Life Sciences ASP Learning Management Systems Survey Results and White Paper (Business Wire via Yahoo! Finance)

Noverant Releases Life Sciences ASP Learning Management Systems Survey Results and White Paper (Business Wire via Yahoo! Finance)
RALEIGH, N.C—-Noverant Inc., a learning management systems provider to the pharmaceutical and life sciences industries, today announced availability of its new white paper “ASP Learning Management Systems: Adapting to the Needs of Small to Medium-Sized Companies.”

‘Secret’ Microsoft Project Ties IronPython to ASP.NET (eWeek)

‘Secret’ Microsoft Project Ties IronPython to ASP.NET (eWeek)
Microsoft unveils a new plan to meld its IronPython and ASP.NET languages and introduces a “secret project” to use them to build data-bound applications.

ASP.NET: programmatically save file to network shared folder

ASP.NET: programmatically save file to network shared folder
Albeit with unmanaged code…By default, the account under which your asp.net application runs is a local account on the machine running your application. You could create a domain account with the same login and password and then give that account permission to read and write on the network folder. ; If that is not the solution you want, create an account like the one below on the domain with minimal priveledges and give it access to read and write on the network folder. Then use the following code-behind to programmatically impersonate and save onto that folder.Assume the following:account login: fooaccount passw: bardomain: mydomainusing System;…using System.Security.Principal;using System.Runtime.InteropServices;namespace testapp{public class WebForm2 : System.Web.UI.Page{protected System.Web.UI.WebControls.Button Button1; ;protected System.Web.UI.WebControls.Label Label1; ;protected System.Web.UI.WebControls.Label lbShow; ; ;[DllImport(”advapi32.dll”, SetLastError=true)] ;public static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); ;[DllImport(”kernel32.dll”, CharSet=System.Runtime.InteropServices.CharSet.Auto)] ;private unsafe static extern int FormatMessage(int dwFlags, ref IntPtr lpSource, int dwMessageId, int dwLanguageId, ref String lpBuffer, int nSize, IntPtr *Arguments); ;[DllImport(”kernel32.dll”, CharSet=CharSet.Auto)] ;public extern static bool CloseHandle(IntPtr handle); ;[DllImport(”advapi32.dll”, CharSet=CharSet.Auto, SetLastError=true)] ;public extern static bool DuplicateToken(IntPtr ExistingTokenHandle, int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle); ;private void Page_Load(object sender, System.EventArgs e) ;{ ; ;… ;}private string SaveRequest(string filename){ ; ;IntPtr tokenHandle = new IntPtr(0); ; ; ;const int LOGON32_PROVIDER_DEFAULT = 0; ; ;//This parameter causes LogonUser to create a primary token. ; ;const int LOGON32_LOGON_INTERACTIVE = 2; ; ; ;tokenHandle = IntPtr.Zero; ; ;// Call LogonUser to obtain a handle to an access token.bool returnValue = LogonUser(”foo”, “mydomain”, “bar”, ; ; ;LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ; ; ;ref tokenHandle); ; ; ;WindowsIdentity newId = new WindowsIdentity(tokenHandle);WindowsImpersonationContext impersonatedUser = newId.Impersonate(); ; ; ; ; ;Request.SaveAs(filename, true); ; ; ;impersonatedUser.Undo(); ; ; ; ; ;return “success”;}private void Button1_Click(object sender, System.EventArgs e){string message = SaveRequest(”\\\\comp\\folder\\ request.txt”); ; ;Label1.Text = message;}}I think the best way to implement this is to throw all the extra interop code into its own class (UserImpersonate) which implements the IDisposable interface and simply use the class.So that it’s something like this:using ( new UserImpersonate ( “foo”, “mydomain”, “bar” ) ){ ;Request.SaveAs(filename, true);}references:Microsoft’s documentation for WindowsImpersonationContext Class. How to implement impersonation in an ASP.NET application