Uploaded pictures not included in project - asp.net

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.

Related

How to show Project folders in browser

I m working in asp.net. I have created folders in my project folder and I want this to show on browser so that when users click on folder name it lists down all the files residing inside that folder.
Below i am attaching a picture which is a perfect example of what I want to do.
I have never done anything like this so i want guidance for this.
By default, if you enable Directory Browsing in IIS, a user can view like this -
However, it is not what you want in ASP.Net Application. Instead, you need to create a page with GridView or other data bound control, and bind it with Data.
If you want too fancy, you want to go with Commercial Components like Telerik FileExplorer.

ASP Site - Updating Dlls on Change

When I make a change to the a aspx.cs page in my website and then build I notice that none of the dlls in the Bin folder are updated, the only dlls I can see in there are the references the web app uses. I want to bring across this one change rather than redeploy the whole site so where are the changes being saved?
I've tried various things like build solution, rebuild solution, build website, rebuild web site.
Is it possible my dll is being sent elsewhere? How would I go about finding out where?
In Solution Explorer, on root project node, right-click and select Properties. Click on the "Build" tab and look under "Output" section. Here you will see the actual output path and can change it to your bin folder.
In Solution Explorer, on root project node, right-click and try to Clean solution and then again build whole solution.

Does changing code of aspx in published website works?

I have a published website and I need to change only the ViewPage(.aspx) code that is giving me an error. If I change that viewpage will it be ok or will I have to publish the website again? If there is no need to publish the website, does it work for css, javascript/jquery files?
If you are only changing visual elements (or in line code that don't rely on a new Project.dll being created) then there is no need to publish the website as long as you are updating the files on the server. If you want VS to send the files to the server for you then you will need to re-publish it.
Publishing is an easy way to build your project, package it and send it to the server so you don't have to mess about with individual files. If you just want to change one file, be it .js , .css or alike then you can just change it.
Depends on what you're changing...
If you're changing elements that have a direct impact with the codebehind in the aspx.cs, then you'll get a runtime error. For instance, suppose you have an aspx textbox and you change the textbox to a radiobutton, or you change the textbox's id field then you'll have to compile the solution and publish the visual page along with the dll to the server.
If, on the other hand, you're just changing css, javascript, or html, and you're sure that does not have an impact on the codebehind, then you can just publish the visual page.
If you change the code of views, then you don't need to publish the site again. If you change code behind then you must publish the dll. When you change the code the dll of your project changes.

toolbar button to upload to Netsuite? (in Aptana Studio 3)

I have Aptana Studio 3, build: 3.0.9.201202141038
I'm using it to edit some Netsuite client scripts (javascript). The netsuite plugin lets me upload scripts to netsuite, which is great, but I have to right click on the filename in the project explorer, pick "Netsuite" and then "Upload"... too many clicks.
What I want is one button to stick on the toolbar that will do the upload. Is this customization possible? Not that I'm lazy but when debugging it becomes a pain to do so much right-clicking.
In Eclipse/Aptana, the "Project Explorer" can do this. If you select a project and/or file within that project, the "Upload" buttons are made available IF you have set up a remote connection to that project.
I am not certain if your uploads/pushes to Netsuite are via FTP but, if they are, just add your remote connection to the project. To do this, expand your project folder the project in the Project Explorer view and then right-click on the Connections icon to add a new (FTP) connection.Once this is setup, any file selected in the Project Explorer can be uploaded with a simply button click from this view.
Not sure if that is exactly what you want but, in the meantime, might get you closer to it!
Hit ctrl+shift+; and the file will save and upload.

Why doesnt my img show up in ASP.NET

I created a C# web project with MSVS 9 and thats all i know about my configurations.
In my browser i can access any aspx files i have in my project. However when i use http://localhost:3288/img/test.png i see nothing. The working directory is ./root, the png file is in ./root/img/test.png How do i have ASP.NET display my images and everything else in the folder? (and subfolders).
Is the .png included in the solution?
When you hit the "play" button your essentially starting up a new website ( localhost:2383 ) so if its not in the solution it won't be copied over to the new, temporary, website that the debugger attaches too.
If this is the problem a quick fix is to hit the "Show all Files" button on the top of your solution explorer, this will show all the files in that folder on your hard drive. Then right click on the .png you want to include and hit "Include in Project".
Based on your comment your only solution is to actually create an IIS site for your solution with the root dir the same as your web project. Then in the project properties you'll have to tell the debugger to attach to your local IIS instead of visual studios. Not sure the exact click path, right click on your project and go to properties, look for debugging options.
Give a look to the ASP Image control , you can specify paths starting in your app root (~):
<asp:Image id="Image1" runat="server"
ImageUrl="~/Images/image1.png"/>
Or you can use relative paths to the page that are displayed.
Check this article about ASP .NET Website Paths.

Resources