w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
StreamReader Server.MapPath - Physical path given, virtual path expected
MapPath translates paths starting from ~ to full local path. Does not look like you need it in your code. If the file is supposed to be at fixed place all the time, open in directly by full path. If it is relative to site root, then use something like Server.MapPath("~/status.txt")

Categories : C#

Website stops working after IIS deployment folder(physical path for virtual directory) is shared
I had the same issue. What I found is when you enable sharing on a directory it removes access permissions for the Appl Pool user and causes a failure. I had to manually add the --SERVER_NAME--IIS_IUSRS user with full permissions to the directory that was shared.

Categories : Asp Net

Trying to create my .cspkg Azure package file, but getting an error "Need to specify the physical directory for the virtual path..."
I was editing the "automatically generated" version of ServiceDefinition.csdef, which wasn't apparent because it didn't indicate it wasn't the actual file, so whenever I rebuilt, it reverted this file back to the original ServiceDefinition.csdef's file, which I WASN'T editing.

Categories : Azure

Creating Virtual Directory returns error
Unfortunately your request is quite a large request- You have a few issues you need to overcome in order to successfully accomplish your task. The Problems: Permissions Ensure Site is configured correctly within IIS. Ensure you've configured a valid Application Pool within IIS. You see these are going to be your largest hurdles; mostly because in order for your site to function correctly it will have to allow the Network Service account to perform functionality- Hopefully this starts to gauge your complexity a bit- Without code it will be difficult to see why this error has occurred. However, based on your listed IP Address that isn't your actual address. You see your machine is connected to a Router which knows which machine made the given request- Which means your real IP coul

Categories : C#

Django under IIS (with HeliconZoo) in virtual directory - urls resolver works with path without directory name
Finally, I've found what's wrong with it. Appeared that the reason for described behavior is a setting provided with default web.config file: <add name="django.root" value="%APPL_VIRTUAL_PATH%" /> After I removed it everything started working fine. Here is some info related to django.root variable applied to Apache.

Categories : Django

Directory.GetFiles() returns full path
You can use Path.GetFileName: string[] ImageNames = Directory.GetFiles(path) .Select(p => Path.GetFileName(p)).ToArray(); This will produce a list with only the names of the files.

Categories : C#

FtpClient.GetListing(path) returns "The filename, directory name, or volume label syntax is incorrect"
I'm sorry for asking this question before I checked my code thoroughly. It turned out that the "<#Root#>/<#Path#>" was the correct path, but some how I had put a "/" before the path - which caused the error.

Categories : C#

Reading a directory returns null when deployed on the apache tomcat 7.0 server
files cannot be null. Your code uses static private List<File> getFileListingNoSort(File aStartingDir) throws FileNotFoundException { List<File> result = new ArrayList<File>(); File[] filesAndDirs = aStartingDir.listFiles(); // may return null List<File> filesDirs = Arrays.asList(filesAndDirs); // would throw NPE for(File file : filesDirs) { result.add(file); if (!file.isFile()) { //must be a directory List<File> deeperList = getFileListingNoSort(file); result.addAll(deeperList); } } return result; } Are you sure you are showing us the right code?

Categories : Java

IIS 7 virtual directory not targeting website root?
To troubleshot 500 errors on IIS, you need to get the substatus (for example 500.19), then check the error code, in the case of 500.19 errors (the more common), you can start here: http://blogs.iis.net/webtopics/archive/2010/03/08/troubleshooting-http-500-19-errors-in-iis-7.aspx. If you're not getting the substatus and/or error code, then you should access the site in the server using localhost.

Categories : HTML

php path with iis virtual directory outside wwwroot
See comment below by Marc B about the dangers of using user provided ['name'] Your code does not show $targetFile defined, only $targetFolder Also, I would recommend using forward slashes.. Set the $targetFile variable and it should work $targetFile = 'D:/WebRoot/FFA/Admin/img/Logo_Files/'.$_FILES['Filedata']['name']; $tempFile = $_FILES['Filedata']['tmp_name']; // Some other Code move_uploaded_file($tempFile,$targetFile); See the PHP Manual for move_uploaded_file

Categories : PHP

IIS can't load image from UNC path nor Virtual directory
The first line of your code: var path = "//192.168.84.52/Distri/Affiche/10038P.jpg" This is pointing to a different IP address than your website having virtual directory. "192.168.154.2". Are you accessing images from another server? In that case you need to check permissions on another server as well.

Categories : C#

what would be the path for the file in the root directory?
When you say "root directory" that usually means the root directory of a filesystem. On most *nix (Linux, FreeBSD, Unix) installs, that means your filesystem path is simply "/". That is, if your config file is there, your PHP file should look like this: <?php include('/config.php'); ?> However, it would generally be both a bad idea and would require superuser privileges to actually put a file at the filesystem root of "/". So it's likely (but we have to guess), that you mean the DOCUMENT ROOT for your web server. Most web servers running PHP make that value available via the super-global $_SERVER['DOCUMENT_ROOT'] as mentioned by Kai Qing in his comment. If that is where your file is, then you could put this in your PHP file: <?php include($_SERVER['DOCUMENT_ROOT']

Categories : PHP

Split-Path with Root UNC Directory
By using the System.Uri class and querying its host property: $uri = new-object System.Uri("\serverfolder") $uri.host # add "\" in front to get exactly what you asked Note: For a UNC path, the root directory is the servername plus the share name part.

Categories : String

Find the root directory without full path in C#
If the subfolder is under the same root as you application you can use Directory.GetDirectoryRoot See: http://msdn.microsoft.com/en-us/library/system.io.directory.getdirectoryroot.aspx

Categories : C#

How to get relative path of files from defined root directory?
That would be os.path.relpath(): >>> import os >>> filename = "C:/test/media/blog_images/2013/06/15/yay.gif" >>> blog_images = "C:/test/media/blog_images/" >>> os.path.relpath(filename, blog_images) '2013\06\15\yay.gif'

Categories : Python

For a Ruby CLI, what is the most reliable way to change directory to users root/home directory?
To summarize Avdi Grimm's screencast on the same subject, If you're using a Ruby version greater than 1.9, the Dir module provides a method #home. However, this depends on the environment variable HOME set on the user's shell session. To reliably get the home dir, you should pass in the login name of the current user to the Dir.home command. Or, in code: # Works if HOME is set in the environment i.e., if "echo $HOME" returns the home directory # when that command is run on the command-line Dir.home # => /Users/<username>, Works if HOME is set # If the HOME environment variable is not set, you should explicitly pass in the username # of the currently logged-in user Dir.home(username) # => /Users/<username> # The current username can be obtained using username

Categories : Ruby

How to set up local repo to have different root directory than remote "upstream" directory of an open source project?
Broadly speaking, No. Git does not allow you to have two different view of the same repository that have different directory structures. Solution 1: Ignore git altogether for uploading That said, I think you don't need this anyway. If your webhost provides public_html, why not just scp the files you want to the location you want? You could make this a task in a Makefile/Rakefile/whatever and then run it from your local machine when you want to upload, for example, a makefile task could look like: upload: scp -r ./upload/* me@myhost:/home/me/public_html/ .PHONY: upload Solution 2: link into your git directory on your webhost Instead of manually uploading your files, simply link your public_html directory to your upload directory in your git repository on your server. For example:

Categories : GIT

VB.NET - Checking FTP directory exists always returns true
Weird. This works for me (I don't cast the request but I guess that shouldn't matter). This is the code I usually rely on: Dim response As FtpWebResponse = request.GetResponse() Using (response) found = True End Using The alternative you have is reading the list of directories: Using sr As New System.IO.StreamReader(response.GetResponseStream()) Using sw As New System.IO.StreamWriter("tempfile", False) sw.Write(sr.ReadToEnd()) End Using End Using In the worst scenario, it should help you to tackle the problem (e.g., it always founds a directory called "ghost", which you might use to trigger the not-found).

Categories : Vb.Net

Directory Services Returns Strange Characters
I was writing the retrieved AD info to a text file so I could check the results. Saving the info in the text file converted all the text into ASCII format, and caused strange characters to be displayed.

Categories : C#

How do I get the root directory of my ASP.NET server application?
Server.MapPath("~"); Will get you the root directory of the current application, as a path on the disk. E.g., C:inetpub... Note that the ~ character can be used as part of web paths in ASP.NET controls as well, it'll fill in the URL to your application.

Categories : Asp Net

php rename() function returns "No such file or directory" error
You'll want to rename these files in reverse order. If you rename .jpg to 1.jpg, then the original 1.jpg is possibly lost/overwritten. Start with the highest number, and go backwards.

Categories : PHP

upload image to root directory from sub directory php
As far as I know there is no problem with accessing other directories, as long as your user has sufficient file access permissions. Maybe try using a full file path $_SERVER["SCRIPT_FILENAME"] and save your file with an absolute path?

Categories : PHP

Upload file into Server Root directory
Use Apache's FTP library to browse and retrieve files from your servers filesystem. You can list out all the files in the root directory by using: .listFiles() Example: String hostname = properties.getProperty("FTP_SERVER"); String user = properties.getProperty("FTP_USER"); String passwd = properties.getProperty("FTP_PASSWD"); FTPClient client = new FTPClient(); client.connect(hostname); client.login(user, passwd); String reply = client.getStatus(); System.out.println(reply); client.enterRemotePassiveMode(); client.changeWorkingDirectory("/"); FTPFile[] files = client.listFiles();

Categories : Java

Python joining current directory and parent directory with os.path.join
You can use normpath, realpath or abspath: import os goal_dir = os.path.join(os.getcwd(), "../../my_dir") print goal_dir # prints C:/here/I/am/../../my_dir print os.path.normpath(goal_dir) # prints C:/here/my_dir print os.path.realpath(goal_dir) # prints C:/here/my_dir print os.path.abspath(goal_dir) # prints C:/here/my_dir

Categories : Python

Directory.Delete(path, true) throws IOException "The directory is not empty"
It appears that info.EnumerateFiles was the issue. I got that idea from this answer. I switched that to info.GetFiles and I was then able to delete the directory after.

Categories : C#

Use Physical Path as Root in Relative Reference
The ~ is the one you want, the "application root operator". It can only be used in server controls, though. Simply adding runat="server" might work: <link runat="server" type='text/css' rel='stylesheet' href='~/site1.css' /> Edit: Apparently the above does not work for link or script tags -- I don't know why. But you could use MapPath, which is equivalent: <link type='text/css' rel='stylesheet' href='<%= HttpContext.Current.Server.MapPath("~/site1.css") %>' /> Alternately, you could use a helper method, which has the advantage of allowing you to shift all references easily. Something like: <link type='text/css' rel='stylesheet' href='<%= Application.GetCssPath("site1.css") %>' /> Where public namespace GlobalUtil { public class Applica

Categories : Asp Net

Rails 2 + Microsoft SQL Server: ActiveRecord returns -1 but SQL server returns records?
So the solution was to change the way ActiveRecord was making the query. database = ActiveRecord::Base.connection query_for_category_bottle_casecost_case_price = "SELECT ..." category_bottle_casecost_case_price = database.select_all(query_for_category_bottle_casecost_case_price)

Categories : Ruby On Rails

Server.MapPath returning a path with a folder that doesn’t exists
I don't believe MapPath guarantees that a path exists, it just tacks your virtual path to the context path. I think your problem is that you're using HttpContext.Current.Server.MapPath try using HttpContext.Current.Request.MapPath

Categories : Dotnet

Redirect all requests to a directory and it's subdirectories to a file inside the directory, using Apache2 server
Place an .htaccess inside project one folder with the following rule: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /php/projectone/ RewriteRule ^(view/)?index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . view/index.php [L] And you can repeat that for any other project folders you have. by changing the RewriteBase.

Categories : PHP

How to run grunt server in dist directory instead of app directory?
Whether or not you could do it isn't important. What is important is that you should not use grunt server for this. The server task in grunt as you can see does many things that you don't need in a dist folder, as well as the fact that they will all be hard coded for your app folder. If you just want to try out the result of the dist folder, what you should do is just cd into the dist directory and then start a simple HTTP server like the one that comes with python. python -m SimpleHTTPServer That should start a small server for you to try the dist directory out.

Categories : Angularjs

.NET MVC - Controller/View and physical path?
Yes, this is possible. Let's suppose that you have the ~/SomeFolder/foo.png file and a ~/Controllers/SomeFolderController. All you need to do is to set the RouteExistingFiles property to true: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.RouteExistingFiles = true; } Now when you navigate to /SomeFolder or /SomeFolder/Index the Index action of the SomeFolder controller will be rendered. And when you navigate to /SomeFolder/foo.png the static file will be served.

Categories : Asp Net Mvc

fopen returns No such file or directory, file exists
The code you've shown doesn't actually prove that the fopen failed. It could have succeeded, and errno just had a leftover error from something that happened earlier. You should only look at errno after you've found that json is null.

Categories : C

How to access a file in a directory from other directory, when both are in same parent directory with HTML
if dir1 and dir2 are in the same parent directory then this is how you access 2.html from 1.html: <a href="../dir2/2.html">link to 2.html</a> hope it helped :)

Categories : HTML

zip with php in root directory
Use the second parameter of ZipArchive::addFile() to specify under which file name the file appears in the archive. basename($file) is a good candidate for that.

Categories : PHP

How to get the root directory
Use Path.GetPathRoot method provided by the framework Gets the root directory information of the specified path For your case you can use: string rootPath = Path.GetPathRoot(filename);

Categories : C#

WCF Rest GET returns nothing when I use virtual properties
I have fixed the error doing this context.Configuration.ProxyCreationEnabled = false; here: public List<User> GetAllUsers() { List<User> usersList = null; using (var context = new AdnLineContext()) { context.Configuration.ProxyCreationEnabled = false; usersList = context.Users.ToList(); } return usersList; }

Categories : C#

Adding Virtual directory under DNN website ,
You might need to add <location inheritInChildApplications="false"> To your web.config file so that DotNetNuke stops handling requests to that virtual directory. Something along the lines of what is mentioned in this answer http://stackoverflow.com/a/782277/21362 An old blog post I wrote might also help http://www.dotnetnuke.com/Resources/Blogs/cid/135153/DotNetNuke-Tip-15-Running-a-webservice-inside-of-a-DNN-site.aspx

Categories : C#

IIS7 Virtual Directory Redirects
When you configure an HTTP Redirect in IIS 7 for a Virtual Directory it creates a web.config file in the physical path. The work around is to point each Virtual Directory to a unique physical path. I use folder structure like this: path edirects[site_name][virtual_dir_name]

Categories : Iis

can we set up mvc project as a virtual directory instead of an applicaiton
You can do this by creating a Site. Now in IIS7, right click on the site and add application, this creates a virtual directory in the site that will behave as an application. The Virtual Directory application will answer on whatever the site is bound too and the path. IE. Site called mySite bound to mydomain.com, the directory the site is pointed to contains a folder called images. We add the application with the alias MySubApp you can then call your new application with http://mydomain.com/MySubApp however, http://mydomain.com/images will go to the sites subfolder. Hope this helps

Categories : Asp Net Mvc

Determining Virtual Directory for wcf services
Right-Click on The Setup Project Choose View - File System Right-Click on Web Application Folder Choose Properties Window You can now change the virtual Directory

Categories : Dotnet



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.