Web Forms :: Checking If Folder Exists?
May 11, 2010
backfolder1=\systemnamefoldername
If
Not Directory.Exists(backfolder1) =
True
Then
Directory.CreateDirectory(backfolder1)
End
If
i am using the above code
but even if the folder exists it creates the directory
View 6 Replies
Similar Messages:
Jul 6, 2010
how would i check if the file path already exists in javascript
View 1 Replies
Feb 28, 2011
I'm trying to error handle a registration aspx/c# page on my application and want to run a check whether the email address that a user has tried to register already exists as the email address is used as a primary key in my database.
I have tried IF NOT EXISTS/IF EXISTS but these dont give the desired effect so was wondering if there was another way around it?
View 2 Replies
Mar 24, 2011
I have a ASP.Net website with links to files stored on a file server. These files are modified constantly and so the links will not always be valid, this includes changes to permissions, files being moved or deleted, etc. I implemented a method in the code-behind to check the validity of these links as they are constructed, if it fails the code will add CSS to change the color of link:
Check URL
/// <summary>
/// Check if a URL exists. Method by http://www.vcskicks.com/check-website.php
/// </summary>
/// <param name="url">URL to validate</param>
/// <returns>True if the URL was resolved, false otherwise</returns>
[Code]....
My problem is that not all the invalid links are getting the style added to them. The strange thing is that when I step through the method in debug mode using one of the bad links that was not colored, the method will return false and color the link as expected. There's a lot more involved then what I present above, but I searched the entire aspx code-behind for any other locations where the link url is being set and couldn't find any. I don't know if there's some post processing going on that somehow clears any styles that were applied to some of the links. The fact that some links are colored while others are not is very confusing to me. Has anyone else encountered similar behavior before?
View 1 Replies
Feb 2, 2011
I've a SQL DB with various tables that save info about a product (it's for an online shop) and I'm coding in C#. There are options associated with a given product and as mentioned the info recorded about these options is spread across a few tables when saved.Now when I come to edit this product in the CMS I see a list of the existing product options and I can add to that list or delete from it, as you'd expect. When I save the product I need to check if the record already exists and if so update it, if not then save a new record. I'm trying to find an efficient way of doing this. It's very important that I maintain the ID's associated with the product options so clearing them all out each time and re-saving them isn't viable unfortunately.To describe again, possibly more clearly: Imagine I have a collection of options when I load the product, this is loaded into memory and added to / deleted from depending on what the user chooses. When they click 'Save' I need to check what options are updates and what ones are new to the list.
View 3 Replies
Feb 14, 2011
As an extensibility option for my web application I would like to allow the user to add sections to it by simply making new folders and uploading files to them. So, for instance, if they created (in the webroot): /UserContent/StaticPages/First/Second/index.txt. Then in the main menu there would be a new menu point "First" with the submenu point "Second", which would lead to markdown-parsed version of index.txt. This way the user can upload any static menu points he wants (such as "About us", "Contact us", "Our Mission" etc.) Another extensibility point is that I would like them to add headers/footers to specific webpages in a similar fashion. I'm using ASP.NET MVC3, so there are pretty URLs, and it would be easy for the user to just create: /UserContent/Additions/Store/Categories/35/header.txt
And when someone opened [URL] the markdown-parsed header.txt would be prepended. This is simple for the user, and simple for me (I don't need to make sophisticated admin panels and WYSIWYG editors). However I'm worried about the performance. This scheme means that on each GET request I would need to scan the /UserContent/StaticPages folder and check for the existences of the header/footer files (several, because parent levels can have their header.txt/footer.txt as well).
I could cache the result, but then I have to manage the cache and the user will need to know that changes can take up to X minutes to display. Would this be a premature optimization? There won't be much data in those folders, so Windows will probably be able to easily cache their contents itself.
View 1 Replies
Jul 28, 2010
I will try and be brief, I am finding when trying to create a custom route with a name and url of properties that my ASP.NET MVC app is returning a 404 file not found when hitting the route.I have deduced this down to most likely be caused by the fact I have a folder on disk called Properties which is of course a common asp.net folder which is automatically created. I have found someone else who has suffered from this problem on SO, but looks like there has been no resolution, only to name your route something different!
Surely this is an oversight, or there must be a workaround? Obviously there will be many common directories you may need as routes and/or folders interchangeably, some of which we already know like Properties probably can't be deleted! I also understand we need to honor real folders as URLs too, but I feel routing should take priority before looking at folders on disk.
View 4 Replies
Dec 13, 2010
I would like to check whether a folder exists or not if not create. I'm sure this folder exists, but for some reason I get "false" when I check with "Exists" method.
The only reason I think could be because of the W: drive? I moved this application to production site and even there it returns false.
while I'm type in Windows explorer on my localhost and on the server "W:/Webs/ASPPages/cropper/uploads" it opens this folder. So my localhost and IIS server has W: mapping.
for test I tried to create the folder then it says can't find the path...
userFolderName = @"W:/Webs/ASPPages/cropper/uploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried "W:\Webs\ASPPages\cropper\uploads"
DirectoryInfo dirInfo = new DirectoryInfo(userFolderName);........
View 3 Replies
Jan 25, 2010
I am working on asp.net 3.5 in C#. In my application I have to Create folder and upload file in that folder, which works fine on my machine. I want help for create folder and upload file in that folder on other machine which is connected in LAN. code for create folder and Upload file on my machine
string FileName = FileUpload1.FileName;
View 4 Replies
Dec 16, 2010
I want to create a folder to store some web controls, so the site structure doesn't have a zillion files in the root.
Except that if I create an ordinary folder, that folder is also visible on the web site. MSDN said you cannot put it in App_Code, and it doesn't really make sense to put it in other special folder like App_Data or App_Theme.
View 3 Replies
Jan 27, 2011
I have requirement to copy or move file from webserver app folder to local file system folder (user selected). How is it possible in ASP.Net.
On my page i have textbox and browse button and user clicks browse button to select folder and there is Copy/Move button and when clicked the files under webserver folder should be move to the user selected folder. The webserver folder path is available to application.
View 1 Replies
Mar 10, 2010
i have a on my project a web forum for new users to register and another forum for registerd users to update there details my question is how do i check when the update or the new user insert occurs
if the mail address they use is not alredy used by another user ?
View 4 Replies
Jun 1, 2010
I am creating a DropDownList at runtime.How do I check if a particular value exists (code snippets in VB please)?
View 2 Replies
Feb 2, 2011
I have a class called 'Tutorial'. At the top of my page I declare the object as below: [Code]....
The last thing I have is an Add and Save button and what I would like to achieve is add/update the record based on if it exists or not. To do this I would like to check the state of the tutorial object to see if it has been loaded and use its id without needing to put it on the page for reference later.
Will the tutorial object still contain values after postback and how can I check if its been declared?
View 5 Replies
Oct 30, 2010
In my application, if I do not input the value into the textfield, it will show error message: "The value '' is invalid."
However, is it possible to check one more thing: the length of the textfield? For example, it will show the error message if I input more than 10 chars? And is it possible to change the message "The value '' is invalid." to "Missing Value"?
View 3 Replies
Sep 2, 2010
Is there any control which has to browse folder path alone instead of selecting folder path + file ?any server side or client side control ?
View 1 Replies
Nov 22, 2015
[URL] ....
In above link you clearly describe (How to display directory folder structure).
The path only works when the folder insight the project.
When I put folder outside the project it didn't work. What type of changes I need to made to acces the folder outside the poject. & How can I show other details of files which are including in folders Like. Last Modified Created Date, Modified Date etc..
View 1 Replies
Feb 9, 2010
Im trying out the Hudson Continuous Integration. After the build is executed i want to copy the content of the ReleaseBuild to another website on the server.This should be possible i guess but i cant seem figure it out.I know this can be done in nAnt and msbuild but i need to make Hudson do it, eg plugin or something.
View 1 Replies
Jan 1, 2010
I am ristrcting access to the Account folder using below:
<location path="Account">
<system.web>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
</system.web>
</location>
and access to the Default.aspx using
<location path="Default.aspx">
<system.web>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
</system.web>
</location>
but how do i restrict access to a specific file in the Account folder rather than the entire folder?
I tried the following but did not work
<location path="AccountChangePassword.aspx">
<system.web>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
</system.web>
</location>
View 1 Replies
Feb 4, 2010
i have one multi line text box in my asp page.
while entering content to it , i want to high light the word by red underline if the spelling of word is not correct (just like in word)
i have to do it without using any button , instead while changing text.
View 5 Replies
Jul 15, 2010
I am using the following code to load user selected HTML files in a Literal control :
[Code]....
Its all working good. Now I want to check, if an html file contains any thing in its body tag (no tag, no text nothing) or not. How can I do that ?
View 1 Replies
Jul 7, 2010
I have written a windows based executable that runs certain scheduled tasks that user enters using a web site.Everything is working as they should, but recently users started complaining that when they schedule a task, it did not run at all.What I have found out was that sometimes the executable gets closed (some users close it accidently).
So I decided to show the scheduler status on the web page and I did the following:
Created a control table (table with one record) in my SQL database with a column called timestamp.
In my Windows application I have a timer that runs every 30 seconds. And I update the timestamp field with the current date and time.And in my web page I check to see the timedifference is <=2 (2 mineutes) with current date. This way I will know the scheduler status.
I am not sure whether this is a good method or not, because of those database calls every 30 seconds.
Could some one shed some light on this? Are they any better ways of doing this?
View 4 Replies
Feb 22, 2010
This seems like it should be easy..... I am pulling some results from a database and then comparing them to a checkboxlist ... if a checkbox item within a list of checkboxes is within this result list, then I want to check that box...this is an 'easy' version of what I am trying to do...
[Code]....
View 1 Replies
Sep 10, 2010
in my gridview i have a list of names that are bound.
in my aspx i have a list of names that i can select from.
i want to see if each selected name is already in the grid.
something like
if (li.Value == row.FindControl("Name").ToString())
View 2 Replies
Jul 17, 2010
In trying to upload images to a server, I often get the following error "Maximum request length exceeded.".
I have tried to check for the size in codebehind but it appears that the error comes from the service provider or something else because I never even get to debug it since the error appears even before the Page_Init Subroutine in codebehind.
What is the best method of checking for the image size and then resizing it dymamically to a maximum file size as well as length and width size.
View 1 Replies