the file is being saved on the server & needs to be same on the local system too so used the above code but the actual size is nt being saved on the local system if the file size on server is 3 MB in local system i gets saved in kbs
I have implemented this in my website as per my requirement. [URL] It is working fine in local. But i moved that code to dev server today... it is showing all the drives of dev server. (But my fuctionality is it should show all the drives of local computer who is accessing this ste).
Created a windows service for my local system for sending bulk mail and it is working.But the same if the want to access the db which is there in hosted server and want to install it in my local machine to access the db details from the server , is not working. While starting a service , it is stopping immediately. Is it possible to do so?
A customer has sent my a screen shot of their event log which shows an error from my ASP.Net app, the problem is it shows the line number where the error occurred but references my PC and the path into my files. Why? There's no references in my code
How to access to the folder drive by using VB.NET or C# in the code-behind (securely: with username and password) for the users to be able to view images on the popup window?
See the code :
Protected Sub BtnServerDrive_Click(sender As Object, e As EventArgs) Handles BtnServerDrive.Click Dim PartNumber As String = txtPartNumber.Text.Trim() 'Calculate the folder 4540 like container Dim NumContainer as string = txtPartNumber.Text.Trim() NumContainer = (txtPartNumber.Text.Trim / 1000 + 1).toString.Split(".").First
[Code] ....
How to achieve this results to access to the server drive to get images for view by using VB.NET or C# in code-behind. Servermappath, UNC, or else?
I have VWD 2010 Express installed. While developing I would like my co-workers to test the application (the parts that are "finished"). When I click "View in browser" for some web form of my application or "Start debugging" the app is shown in my browser at:
http://localhost:3424/Default.aspx
My IP on local network is 192.168.1.14. How can my co-workers access this page?
Note: I do not have IIS instaled (just ASP.NET Development Server).
I want to populate members of a local computer group on a webpage and allow the user to add / remove users of that remote computer from a group say Administrators or Remote Users Group.
The application pool will be running with a user who is admin on all remove systems.
I have written code that uses a .bat file (code: rwvinstat /server:servername) that populates a DataGrid of users logged in to a terminal service session in c#. The .bat lives on the server with the app. files and will run properly if executed manually on the server .Also if i run the app. locally and call the .bat file on the server it works fine.
The problem is when i deploy my web app on the server the DataGrid never populates nor do i get any errors. i have given full permissions to IUSER_MACHINENAME(and various users) and i set the virtual directory permissions to read, run, execute. Ialso have set my web.conf fig to:< "identity impersonate="true" userName="username" password="password"/> Here is my Source code:
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Text; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.IO; public partial class ilsap01_users : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("C:\listUsersIlsap01.bat"); psi.RedirectStandardOutput = true; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; psi.UseShellExecute = false; System.Diagnostics.Process listFiles; listFiles = System.Diagnostics.Process.Start(psi); System.IO.StreamReader rawUserData = listFiles.StandardOutput; listFiles.WaitForExit(20000); try..................
I have an ASP.NET page that I need to have access the local file system. It's an intranet. I need to download a zip file and an executable to a temp location and then run the executable.
Then afterwards, I need to delete the contents via an ASP.NET page.
Is there any way to access the local file system? Generally, I would think this would cause a security concern, but I've seen posts about Silverlight being able to access it.
I have tried to deploy a project using Windows Installer Deployment. And Successfully installed it in computer. But it is unable to connect with the Database in my system. Earlier the same project worked from my Visual studio but it is not working after the deployment.
I'm using one XP with SP 2 as my local Laptop PC . Its IIS has one default web site, of course, which is the site I'm working on. When some feature is finished I deploy it to my "production" site which is hosted somewhere else. Very common situation, I guess. This app uses email to notify customers of some particular events. Works on production, but sometimes I need to change something in the way those notifications work. Currently I have to upload the changes to "production" to check it out. Is there any way for me to set up smtp server on my local machine so I could work locally with those features?
I've received a website that uses sql server on the live environment. In the code at many places sql is created, say: However, locally on my dev machine, I use sql server express edition. It looks like select * from mytable doesn't work there, but instead I should use: How can I get my local site to work? Is there a setting I can change or am I missing something else?
I am using a smtp to send email from asp.net (C#)code. it sending some email instantly but many of email is making a queue in my Inetpub folder at local system.
Short Version: Can anyone say whether it's possible or not to use impersonation in ASP.NET to access mapped drives?
Long Version: I'm currently using impersonation in ASP.NET to gain access to network files. This is working perfectly for any network file using a UNC path, but it is failing to access any files on mapped drives defined for the user account I'm impersonating.
For example, let's say a file lives on the network at "machinefolderfile.txt", and let's also say that drive S: is mapped to "machinefolder". We need to be able to access both the full UNC path, "machinefolderfile.txt", as well as the shorter, mapped drive path, "S:file.txt".
Obviously the standard ASP.NET process cannot access either.
Using a console application that runs under the local account with the mapped S: drive, calling File.Exists(@"machinefolderfile.txt") returns true, and File.Exists(@"S:file.txt") also returns true.
However, when impersonating in an ASP.NET context with the same local account, only File.Exists(@"machinefolderfile.txt") returns true. File.Exists(@"S:file.txt") returns false.
I'm testing with IIS 7 running on my local Windows 7 Professional box, though this will need to run in both IIS 6 and IIS 7.
Impersonation is handled with a couple of classes in C# which I'll include here:
public static class Impersonation { private static WindowsImpersonationContext context; public static void ImpersonateUser(string username, string password) { ImpersonateUser(".", username, password); } public static void ImpersonateUser(string domain, string username, string password) { StopImpersonating(); IntPtr userToken; var returnValue = ImpersonationImports.LogonUser(username, domain, password, ImpersonationImports.LOGON32_LOGON_INTERACTIVE, ImpersonationImports.LOGON32_PROVIDER_DEFAULT, out userToken); context = WindowsIdentity.Impersonate(userToken); } public static void StopImpersonating() { if (context != null) { context.Undo(); context = null; } } } public static class ImpersonationImports { public const int LOGON32_LOGON_INTERACTIVE = 2; public const int LOGON32_LOGON_NETWORK = 3; public const int LOGON32_LOGON_BATCH = 4; public const int LOGON32_LOGON_SERVICE = 5; public const int LOGON32_LOGON_UNLOCK = 7; public const int LOGON32_LOGON_NETWORK_CLEARTEXT = 8; public const int LOGON32_LOGON_NEW_CREDENTIALS = 9; public const int LOGON32_PROVIDER_DEFAULT = 0; [DllImport("advapi32.dll", SetLastError = true)] public static extern int LogonUser( string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr phToken ); [DllImport("advapi32.dll", SetLastError = true)] public static extern int ImpersonateLoggedOnUser( IntPtr hToken ); [DllImport("advapi32.dll", SetLastError = true)] public static extern int RevertToSelf(); [DllImport("kernel32.dll", SetLastError = true)] public static extern int CloseHandle(IntPtr hObject); }
Then, during Page_Load, we basically do something like this:
if (!File.Exists(@"S:file.txt")) throw new WeCannotContinueException();
I realize using mapped drives isn't a best practice, but for legacy reasons it's desirable for our business. Can anyone say whether it's possible or not to use impersonation in ASP.NET to access mapped drives?
I am using crystal reports in my web application which came along with visual studio 2008.My problem here is export and print buttons in crviewer are working fine in my local system but when i hosted the app in server actual problem came into picture.Export and print buttons are not working.
I have seen some examples on other sites , but since im not familiar enough with DirectoryInfo and Files from the System.IO namespace, i dont know how to change it to fit my needs. So i found a very simple example that works, but i have some questions.
Here is the code i found:
[Code]....
This works great and lists the files in my root directory.
#1 - What i need to know is how to accomplish the same thing but in a format i can control, this code simply displays the files at the top of my page and pushes everything down. So does anyone know of a good and simple tutorial written in C#?
#2 - I also need to be able to setup the code so that certain files within the directories are not displayed, as in the code behind files and other files to be determined by the business.