VS2012 not showing images uploaded by controller - asp.net

I created a page for uploading images,it works good,but when I want to show that uploaded image in a view I can't.
My images are stored in Images/products/{product name}/
In view I wrote
#Foreach(var item in product.images){
<img src="~/images/products/{productname}/#item.name" />
}
//my name spell are correct
In debug src has correct value but doesn't show image,
But when I give an URL from content folder it shows that image,
Even in solution explorer. VS doesn't show uploaded images and created folders by controller codes,

you might need to add permission to Images/products{productName} folder.
Open IIS Manager
Click on the web site or application that serves the images
Click the "Basic Settings link on the right - take note of the App
Pool name and cancel that dialog.
Click on Application Pools in the server tree on left In the list of
app pools - note the identity for the app pool with the name you
noted in step 3
Now in Windows Explorer, you can right click the image folders,
choose properties, and click the click the security tab. Find the
user associated with the identity used by the app pool. If it's not
there then there's no permissions If it's there, click on it and
look in the permissions pane to make sure "Read" is checked (or write/modify or even full control if you need).
you will need to repeat the step if you add sub folder manually on the Images folder
It's a best practice to save image on Content file since it by default already have read access. or another way is you could save your file on App_Data or hosting the file on cloud (with time limit to show for better security).

Related

CFdirectory tag doesnot display files in a directory even if the files appear in the source folder

I am trying to read a spreadsheet from a shared location folder. using
<cfparam name="xlfilepath" type="string" default="\\file02\OP\!FILE STRUCTURES and FORMS\Agreements\Tracker.xls" />
<cfspreadsheet action="read" src="#xlfilepath#" excludeHeaderRow="true" query="MsaDataSheet1" sheet="1" />
"OP" is the shared folder.
I got "java.io.FileNotFoundException:".Then I try to display the directory listing using cfdirectory tag.
<cfdirectory action="list" directory="\\file02\OP\" recurse="false" name="myList">
<cfdump var="#myList#"><cfabort>
I see that there is no list displayed although there are subdirectories and folders and files in the OP directory.
Does the folder needs any specific permissions to be read by any application or any other mapping required?
Here I will explain by using cf16. The ColdFusion runs in Windows as a service and if we look into all the services of the machine we will find as follow:
Here, you can notice that for ColdFusion service the LogOnAs value is "LocalSyatem". It means ColdFusion service is started as "LocalSystem" login and this login doesn't have enough permission to do any operation on network. So, in order to make the required file operation in the Shared Directory we will have to change the LogOnAs value for ColdFusion service.
Please follow the below step to enable it,
Right Click on the ColdFusion Service then click on "properties".
Click on "Log On" tab. Then you will see a screen like this
Select "This account" radio button .Then click on "Browse" button
and select the user by which you want to start the service. You
should choose the user who have sufficient permission to create file
on the shared directory and also have required permission in local.
But we have to restart the ColdFusion Service for the changes to effect.
Let me know if this work to you or not. Or correct me if I'm wrong understood.

Telerik rad async file upload control is working well locally but not in server

I am using RadAsyncUpload control from Telerik to upload a file on the server. It is working well locally (on localhost) but not in the server. What did I miss?
(When I select a file to upload the dot becomes red instead of green)
I had the same behavior and it was a folder permissions issue.
Another symptom in this case, Chrome DevTools console was showing the following error when I attempt to upload a file:
HTTP Error code is 500
There is a temp folder where RadAsyncUpload saves files temporarily. If you don't define the TemporaryFolder property on the RadAsyncUpload control, the default will be in your App_Data\RadUploadTemp folder. If IIS_USERS don't have write permissions to this folder, the upload can't save a file here. It will work on your localhost because you have write permissions to that folder. Here's how to give the permissions necessary.
Right click on the App_Data\RadUploadTemp folder on server and
select proprties
Select Security tab
Click "Edit..." button
Under "Group or user names:", select IIS_USERS
Under "Permissions for IIS_USERS", check Write in the Allow
column.
Note: This was IIS 7 on Windows 2008 R2 Server.
The dot could become red either when the allowed file extension validation failed or when the file size exceeds the allowed one.
You can attach to the OnClientValidationFailed and OnClientFileUploadFailed events and check what the exact error is and fix it.
The Troubleshooting article offers additional information about the different errors and how to solve them.

Restrict document access to particular user in alfresco

Is there any way by which I can show particular documents to particular users only ? In alfresco, all users from a site can see all the documents. I want to show the particular document to some users only. I am using alfresco community edition. Can somebody help me ??
Thanks
A site is just a folder. The site folder contains "container" folders for things like the document library, wiki, data lists, etc. You can set permissions on these folders just like you can any folder in Alfresco. Similarly, documents can have their permissions set individually.
The confusion arises because when you are using Share in the context of a particular site, the permissions settings don't offer granular settings. But if you navigate to your site through the "Repository" view (see the link at the top of the page), you can have full control over the permissions.
Suppose we have a site called test-site and a folder called test in that site's document library that contains a document, testdoc.pdf. You should be able to:
Click the "Repository" link at the top of the page.
Click the "Sites" folder.
Click the "test-site" folder.
Click the "documentLibrary" folder.
Click the "test" folder.
Click testdoc.pdf to open its details page.
Click "Manage Permissions".
By default, objects inherit the permissions of their parent. So testdoc.pdf has the permissions of its parent folder. If you want to remove all permissions and set explicit, "local" permissions on testdoc.pdf...
Click "Inherit Permissions" to turn off inheritance.
Click "Add User or Group" to add specific users or groups with the access level you want them to have.

How do I allow the user to select the path for a file?

In an application I'm working on, the users are prompted for the path of a file. This path will always point to a network drive, which the server has access to.
Currently, we use an asp:FileUpload control to accomplish this, drawing the path from the FileUpload's PostedFile.FileName property.
The problem is that the files the user is selecting from are locked down pretty severely. While the server has full access to them, the user only has permission to view the directory contents... They can't even open the files. This has worked fine up until now... But Windows 7 won't display these files in the file picker generated by FileUpload, so we need an alternative.
Notes:
Looking for a way to get UI similar to the file open dialog already in place.
The ability to view the client's local files (including the shared network drives) is a bonus, although listing the files through the server is acceptable.
I think the problem is the permissions on these files. If the users can't even open them, how can their terminal possibly upload them to a website?
I'm surprised this has ever worked.
If the user is simply supplying a path and not actually uploading the file you could have the server display the contents of the folder (in a list or whatever) and the user selects from that.
So how about creating a file browser in a window, such that a user clicks "Pick File" which opens a new window showing the root contents of the network drive. The user can then navigate round the directories to the file they want, finally clicking the file to "upload".
Use System.IO Directory.GetFiles to get the files in a directory.
I think you need to separate out the two things. Here's an example prompt to convey the idea:
Select a (file from your computer) OR (file from the server)
Client Files
You can use the standard file-upload control, that is fine.
Server Files
No user should be selecting files from your sever with the upload-file dialog. (Keep in mind that these dialog boxes allow right-click menus delete, copy, properties, etc and locked down or not, the user should not think they have this ability).
I don't think there are any controls that will "do-it-all" for you in this manner. I think your best bet is to make your own interface here.

Uploaded pictures not included in project

I have upload control on my asp.net page. I upload pictures in folder cars and they show in windows explorer when I open that folder (cars), but in Visual Sudio they act like they not include in project ( that is the reason why they don't show on image control which point to some of them. What did I make wrong ?
Uploading the images in the web application will never make any changes to your project. You will have to add them manually if you'll need them there. But generally these are pictures added by your user so the would just be in the file system - not really part of the solution, are they?
If you have choosen a webSITE then it will allow this, but not if a webPROJECT is selected.
I didn't find this on net, but I had two projects, and the one which was allowing me to show uploaded files was a website.
You have to click the refresh button at the top of the solution explorer in Visual Studio for it to show changes to the files.
You have to click Refresh button. Also ensure that "Show all files" icon is selected. And finally, you will have to right click on the files and select Include in Project. That way it would become part of your project.
If I may ask, what exactly are you trying to achieve in your application? The reason I ask is, if there is an upload happening in your application, you shouldn't need to include the files in your project to refer to it from code.

Resources