Strange Behaviour From System.IO.DirectoryInfo. Exists Function?
Nov 13, 2010
I am developing an application using c# and asp. It need to access some places in the local network . There is a text box in the form which accept the path to be accessed from the user and will store it to a string variable named location.The if loop always return false if the application run in windows 7. and it occurs only when I run from the installed application, otherwise it will return true if the path is true. Here is the code:
[code]...
View 5 Replies
Similar Messages:
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
Dec 20, 2010
I am using the MaskedEditExtender and MaskedEditValidator, but have experienced some strange
behaviour. (See code example below). When entering a date into the textbox this is what I see:
1. The mask
2. Entering the date and time e.g. "19-01-1980 10:11:12"
3. When removing focus from the textbox the result is: "19-01-1980 19:01:19"
The six first digits of the date is copied as the time? If entering a day of the month larger than 23 and any given month, year and time (eg. 25-10-1980 12:12:12) the validation fails as the six first digits are copied to the time resulting in a time 25:10:19 which obviously is not valid.
I have downloaded the AJAX toolkit sample code and experience the exact same behaviour. When running the AJAX Toolkit samples from[URL] works fine!
Additinal info: Culture is danish (DateTime format is dd-MM-yyyy hh:mm:ss). Tried changing my systems culture to en-US but same behaviour.
Code:
[Code]....
View 5 Replies
Jan 12, 2010
Some one can explain me the behaviour i am observing is correct..?
[Code]....
and here is the connection string:
<add name="SecurityDB" connectionString="Data Source=xyz,8000;Initial Catalog=abcd;User ID=abcd;Password=defg" providerName="System.Data.SqlClient"></add>
i expect it to fail at 101 iteration as the default max pool size is 100 and i am not releasing any connection after i open(ie., Not closing or Disposing). But the strange behaviour is i can go up to 230 iterations and then it gives me a timeout error, can not acquire new connection.
When i look in SQL Database for number of connections created it is only 100.
My question is : When connection is not released, how is it able to re-use the previously opened connection.
View 9 Replies
Jul 18, 2010
I have ListView and in the ItemTemplate I have:
[Code]....
in code behind I'm doing:
[Code]....
View 6 Replies
Jun 10, 2010
I'm having a strange problem - probably has a simple answer but, I haven't been able to find it or figure out the cause. I'm hoping someone has had this same problem and figured it out.
Basically - my application works great on the development machine. So I copy it over to the server and it works great. Come back the next day and my GridView is only displaying the first record...I then log into the server remotely and open the web page on the server and all records are returned, so the application works fine on the server. I then return to the local machine and now the application is returning all rows in the GridView. So, weird but, what whatever, it works. Go away and come back again the next day and...
1 ) Only 1 record from dataset is displayed in GridView
2 ) Log onto server remotely and view webpage on server --> all records now display
3 ) Try again on local machine, now application works fine...grr. What am I doing wrong here? Using Visual Web Developer 2008 on Windows XP. Querying SQL Server 2000 (I know, I should switch to 2005 and use VWD 2010 - but ouch, really!) when a text box value changes (Vendor_PO_TextBox.TextChanged)
[Code]....
View 1 Replies
Jan 7, 2010
I've sucefully runned it in my local server (Windows Server 2003 Standart) but after tried several times upload it to my hosting, it never works. The web hosting company told first that they didn't had System.Web.Routing.dll installed (but they said that they've .NET 3.5 installed..), then i've copied the dll to Bin folder and again with no sucess. Can someone give me a very basic example of and website using System.Web.Routing.dll so i can do the "final" test on webhost before i go to the company because they say that they have 3.5 installed but i'm starting to see that they didn't have? If possible, is there another way to test if this dll is installed in web hosting? (test all .dll running for example)
View 1 Replies
Apr 14, 2010
Our web application hosted from windows 2003 server, is trying to access a file present in a shared folder of another windows 2003 server. The path for the shared folder is configured in the webconfig file in the below format.
<add key="ReportPath" value="\<Server_Name>Reports"/>
if (!File.Exists(ReportPath))
/ Show the report in a link
This function File.Exists() always returns false and when I try to remove the check, it returned the exception, "Logon failure: unknown username or bad password."
View 2 Replies
Feb 8, 2011
I want to be able to determine programmatically if the System.webServer/Security requestFiltering section exists inside the the web.config file of my application.I am able to do it for other sections like system.web using the code below, but so far no luck with system.WebServer.
var config = WebConfigurationManager.OpenWebConfiguration("~");HttpRuntimeSection section = config.GetSection("system.web/httpRuntime") as HttpRuntimeSection;
Label1.Text = section.MaxRequestLength.ToString();
View 1 Replies
Sep 15, 2010
I'm making the leap to move from vb.net to C#, and I'm getting this crazy error when I try to execute one sp, set a value, and then execute another sp based on the value. proc_GetSectionDetails is my first stored procedure. From that, I get a value for SectionID, and then use it for the second sp called proc_GetSectionDetails
[Code]....
View 2 Replies
Jan 24, 2011
I have a control on a master page called "panel1". I would like to access it from my Javascript on the content page. I have tried var panel1 = document.getElementById('<%= panel1 %>'); It doesn't work since it is on the Master page.
View 5 Replies
Jul 20, 2010
I have a virtual directory setup in IIS6. This maps to a shared network drive.
I can correctly map the path using
string mappedPath = HttpContext.Current.Server.MapPath(path);
I then create a DirectoryInfo object as I want to find some files in the directory.
DirectoryInfo updateDirectory = new DirectoryInfo(mappedPath);
But then updateDirectory.Exists is false?? I can take the string from the mappedPath and copy into Start->Run to get to the path so I know it exists. I am authenticating to the webservice using integrated windows authentication and have permissions to the necessary folders.
Is there something obvious I'm missing in the code? Or is this purely set-up and configuration of IIS etc.?
View 2 Replies
Sep 22, 2010
the maximum number of files in a folder, I noticed that DirectoryInfo.GetFiles().Length is returning a System.In32, but the Maximum value of a Int32 is 2.147.483.647 (Int32.MaxValue) while on NTFS (an many other filesystems) the maximum number of files can go far beyond that.
on NTFS it is 4.294.967.295 single files in one folder (probably an Uint32)
Which leads me to the interesting question:
Is it possible to get the number of files in a folder on NTFS with the .NET framework, when the number of files exceeds the Int32.MaxValue, in an elegant and performing manner?
View 1 Replies
Dec 1, 2010
I'm trying to pass email addresses from an array to a stored procedure, then display the results in my gridview. I get the following error:No mapping exists from object type System.String[] to a known managed provider native type.On this line: Dim DR As SqlDataReader = MyCommand.ExecuteReader
[Code]....
View 4 Replies
Jul 8, 2010
I want to use the System.DateTime.Now() function (to get system time) rather than the Date() function (for user's time) in a Javascript routine of an ASP.net web page, however this does not seem to be supported in Javascript (as it is in VB.net).
View 11 Replies
Jan 8, 2010
I trying to display image in picture box. The application have two part.First part is windows application, and second part is web service (asmx).This is the code for windows application:
Public Sub PrikazSlike()
Dim p As localhost.Service1 = New localhost.Service1()
PictureBox1.Image = Image.FromStream(p.PictureShow()) [code]....
The problem is that function in web service does not return System.IO.MemoryStream data type so I getting error message can not convert:
Error 1 Value of type 'WindowsApplication1.localhost.MemoryStream' cannot be converted to 'System.IO.Stream'.
View 4 Replies
Mar 30, 2010
I have written this query for retrieving data from mysql as below
select FeedbackCode,EMailID,FeedbackDetail,
Date_Format(FeedbackDate,'%m,%d') as 'Feedback_Date'
from FeedbackDetail
where EMailID not like '' and InstanceCode =5
and I'm binding this data with GridView in asp.net but at the column of Feedback_Date,
instead of Date I receive System.Byte[].
View 1 Replies
Aug 31, 2010
I have a chat application I've developed which sits inside a master page. When the user presses enter inside his/her chat input field, I want that to trigger the submit chat behaviour (same as clicking the 'submit' button under the chat input field), but because there is another submit button inside the master page and higher up the page (a search function), that is what gets triggered. So if the user hits enter, s/he gets sent off to the search page.
View 2 Replies
Jan 25, 2011
I have a site that i have developed in asp.net. On debugging the site now hosted using iis7 i noticed a bug, i cannot reproduce this when i run it locally in vs, meaning i can't see the error. The bug occurs on the check box changed event of a devexpress check box. It connects to the database using devart.postgres sql component and linq. However, this is the same connection as anywhere else in the project. The same code works elsewhere in the project. The error i get is:
the requested name is valid, but no data of the requested type was found.
part of my code is in an if statement that checks if a textbox is blank if so it does not run the code within the if statement, interestingly enough if the text box is blank the code runs, so it must be in the if statement? i commented out all of the code and tried again and it still would not run. B
View 1 Replies
Jun 2, 2010
am having trouble with some javascript that isn't working as it should. I have a table with 6 rows in it. There are 3 rows with a checkbox in them and 3 rows with a dropdownlist. The order is cb ,ddl, cb, ddl, cb ,ddl. The ddl rows are all hidden in th beginning using style="display: none;". When the user checks a checkbox, the ddl row below should appear. But this is not happening, instead it happens when i uncheck it.
[Code]....
View 3 Replies
Feb 19, 2010
Recently I got a strange behavior, the website hangs and just doesn't reply unless I go to iis and restart either app pool or whole IIS - BUT what is the most strange thing is that in case I go to remote desktop of the server and try to access it locally it DOES work just fine. I read couple threads about deadlocking and hanging because of memory leaks and non closed sql connections BUT why it still does work from the local?In case there is something wrong with the code - why does it still work from locally?
View 2 Replies
Jun 18, 2010
I am trying to accomplish the following.I am displaying records from a database query that include a datetime value. If the datetime value is before the year 2000 (the database defaults to either 1753 or 1900), I want the textbox associated with the CalendarExtender to display nothing. So I created a control library, made a new class 'DateTextbox' and inherited from TextBox.I added the following code:
public class DateTextBox : TextBox
View 2 Replies
Jun 24, 2010
After login, user get redirected to other page than destination page.actually i used asp.net2.0 login control and there set a destinatuion page url but after login user get redirected to same page or home page.
View 1 Replies
Mar 23, 2011
I have a web site coded with VB + MS Access database (VS2010). I'm using one MasterPage to manage both public and users area. I'm facing loss of session variables when a user is logged in. I can't figure out what is wrong and I need your help, tips and tricks.
When a user is authenticated (thru the Login.aspx), I create a SessionID, store his credential in session and load user's page by Response.Redirect(~/users.aspx). Here is what I did:Code:
Dim MyLink As String = Session.SessionID & "other variables"
Session("MyLink") = MyLink
FormsAuthentication.RedirectFromLoginPage(TextBoxEmail.Text, False)
Response.Redirect(~/users.aspx)
My logic is this: when the web site is launched, MasterPage + Default.aspx load. So Session("MyLink") is empty. If the user's credentials are correct, I create the session so that it can be available for MasterPage.
In the code behind of the MasterPage, I try to check (everytime a link is clicked/page requested) whether the user session (SessionID, credential in session) is available. If so, the user is still logged and get access to all the menu. If no session is available, it means the user is logged out or not logged in yet and few menu are shown. Here is the code
Dim MyLink As String = Session("MyLink")
If MyLink Is Nothing Then
'Only show MenuPublic
[code]....
My default menu is:MenuPublic1, MenuPublic2, MenuPublic3
When a user is logged in, I add to the MenuPublic some reserved Users' menu like below.
MenuPublic1, MenuPublic2, MenuPublic3, Menu_Users1, Menu_Users2, Menu_Users3
In local, everything works perfectly fine. Now after hosting my website, from time to time the MasterPage loss the Session variables. When it happens, the page still shows that the user is logged in by displaying Logout and Welcome Username beside it.
View 7 Replies
Feb 17, 2010
I am using asp.net C#.
I have one html input field, and 3 image buttons (asp.net controls)
ImageButton 1 = perform delete operation
ImageButton 2 = perform Edit operation
ImageButoon 3 = perform duplicate operation
My problem occurs when the user presses the enter key when the input field is in focus. When he presses the enter key the browser automatically fires by default the next button. In my case it is the delete operation.
View 1 Replies