Finding runtime errors in a singleton class

Hi, How to find the memory leaks in a singleton class? How to instantiate the object of a singleton class? Actually how to run the singleton type classes manually in a website?.
discussion1:Its hard to say based on what information you provided.I usually create singletons like this: http://wiki.asp.net/page.aspx/288/singleton/Other patterns such as the synclock double check pattern are not as reliable as they might appear..


Continue reading

ASP.NET user in MS SQL Server

Hi,I want to showcase ASP.NET to my boss. I have deduced from error messages and Internet research that the problem is -> MS SQL Server 2005 (Express ed) requires an ASP.NET user. Note, I can manipulate the db without a problem through normal ADO.NET using any non ASP.NET app. But as soon as the project is an ASP project, I cannot interact with the db. Who can solve this riddle? .
discussion1:We will need a little more to go on.Do you have a ConnectionString in your Web.Config?What version of .NET are you using? (3.5 and LINQ make it rediculously easy)Do you have a code sample of what is NOT working?Do you have an error code and/or a stack trace?.
discussion2: To test, you need From Server Explorer in VS make a connection to your Datbase, then if successful then Drag a table into your form.check this works or not .
discussion3:We are using visual studio 2005 and SQL Server 2005 (expressedition). Unfortunately, I cant give code snippets until Monday morning when Ihave access to his laptop again. I was hoping this was a common thing that justcould be answered generically. In my research, I have found many people askingthis question. I have never found anyone able to answer it. .
discussion4: Hi,if in your db connection string is like this:.... Integrated Security=True.... You need to add user ASPNET to your database Or you can replace your Integrated Security to.......................... User ID=(an sql server account); PWD=...... .
discussion5: Thanks Thoeun, Integrated Security=True was in the connection string. How do I add user ASPNET to the database ?.
discussion6:when an asp.net web page runs, it runs under a special account. if your page is running under xp, then that account is the local ASPNET account on the box serving up the pages. If your page is running under Windows Server, then that account is the local NetworkService account on the box serving up the pages.If SQL is running on the same box that is serving the asp.net pages, then you can add those accounts into sqls accounts and give them permission. If sql is running on a different box though (which is usually the case) then that other sql server box will not recognize the local accounts from the asp.net server. In this configuration, you could use mixed mode security for your SQL server instance and create a SQL account directly in SQL server itself. Then from your ASP.NET box, you would specify those credentials in the connection string.various types of connection strings can be found here: http://www.connectionstrings.com/ .


Continue reading

retreiving variables in .ascx page , from .aspx page

Hi,Ive googled this problem, and found a few threads, but its not fixing my issue. I have a user control (myheader.ascx) in which I programatically set 2 variables. I am trying to get the value of these variables in an aspx page, but the values are always nothing. I can reference the values in the aspx.vb code behind.Heres what Im doing, does anyone have any suggestions ?? Thanks very much!!mike123 Private _isFrom_Search As BooleanPrivate _SearchGender_forBind As StringPublic Property isFrom_Search() As BooleanSet(ByVal Value As Boolean)If Not String.IsNullOrEmpty(Value) Then_isFrom_Search = ValueEnd IfEnd SetGetReturn _isFrom_SearchEnd GetEnd PropertyPublic Property SearchGender_forBind() As StringSet(ByVal Value As String)If Not String.IsNullOrEmpty(Value) Then_SearchGender_forBind = ValueEnd IfEnd SetGetReturn _SearchGender_forBindEnd GetEnd Property and in the aspx.vb page I have these 2 lines : (these are excerpts obviously =])If myHeader.isFrom_Search = True ThenSelect Case myHeader.SearchGender_forBind.
discussion1:Maybe you reference them in your page in the event handler, that executes before the controls event handler, that initializes those variables? Try to play with the breakpoints..
discussion2:mike123:.
discussion3:Hey Guys,I am setting the values in my myHeader.ascx page on this subPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load I am attempting to retrieve them on the aspx.vb page, on this sub:Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Regarding the steps:1.) ok2.) ok if the user control is created with no default values3.) ok I am setting a property either false or true, and I am always retreiving NULL in the aspx.vb page4/5.) what do you mean by potentially initializing? Any further help is greatly appreciated !! .. still pretty suck on this .. thanks agian,mike123.
discussion4:You need to set a breakpoint in your page_load of the aspx and watch the order everything happens.I have a feeling that your problem is the page life cycle of the page and the user control..
discussion5:hi scriptstudios, good point... after stepping thru my code, I have realized that the Page_load of the aspx file actually fires before the Page_Load of the ascx file.Does this mean what I am trying to do is not possible ? At this point it sure seems like it.since the value passed is determined programmatically, passing a default value is not an option.youve been a great helpthanks again!mike123.
discussion6:I think you need to add a string property rather then Bool to check that it works,Remember a point, If you use simple property types such as int, DateTime, float, and so on, you can still set them with stringvalues when declaring the control on the host page. ASP.NET will automatically convert the string to the propertytype defined in the class..
discussion7:Hi,Isnt passing datatypes and relying on implicit conversion bad practice ? I tried doing this but no luck ...... Can anyone chime in here and comfirm its definately possible ? This issues killing me thanks again,mike123.


Continue reading

unable to delete image

hi!i am trying to delete image on folder on server.this code is working when i am deleting the image which is copied from my local sys to server. but the same code is not working when i try to delete to the image which is uploaded through the fileupload control. dont ustnad the condept. i just changed the imganame but image not delted.whats realy wrong. pls suggest.Tryimgname = "sample.jpg"File.Delete((Server.MapPath(imgname)))Catch ex As FileNotFoundException lblStatus.Text += ex.MessageCatch ex As Exception lblStatus.Text += ex.MessageEnd Try.
discussion1: Tryimgname = "~/foldername/sample.jpg"File.Delete((Server.MapPath(imgname)))Catch ex As FileNotFoundException lblStatus.Text += ex.MessageCatch ex As Exception lblStatus.Text += ex.MessageEnd Try.
discussion2:no luck friend.pls suggest anyother way. i want to delete old images. .
discussion3: What error are you getting?.
discussion4: Hi,AbithaPlease Cler Up ur Problem.Thanks. .


Continue reading

How to get started with ASP.Net

Dear Friends,I am a C#.Net and VB.Net Developer. But I Dont know even HTML in Web developement field. I am planning to get started with ASP.Net. Pls guide me How to begin with? Which is the best book to get started.Thanks in Advance..
discussion1:Hello,You could start from here - http://www.asp.net/learn/Here you could find some good ASP.NET books and reviews - ASP.NET BooksRegards.
discussion2:Hi,emcubeWelCome To the forumns.asp.netFor Basic u can Refer Following Urls Here U will also get Html Knowledgehttp://www.w3schools.com/For Basic of Asp.net U can refer http://www.asp.net/get-started/U can Also Refer http://www.asp.net/learn/ There are numerous of Videos along with source codes which will help u.and for ur queries U can post ur queries here on the Asp.net Forumns. As far as Books in each section of the forumns on the right side there is window where list of good books are shown U can Refer That .example on the page http://forums.asp.net/15.aspx at the right side there will be section Recommended Books .U can Refer That PLZ MARK AS ANSWER IF IT HELP U.THANKS. .


Continue reading

two progress control work with eachother

I used progress control in my website.one of it is n masterpage and another in in a content.when i press the button that is in content page ,both pic that is in progress control in master page andthe pic in content work.i want to when i press the button in content only only progress control of content work.is it passiple?how?.
discussion1: Are you sure you have 2 different updatePanels for each UpdateProgress control ?Can you show the masterpage and content page code? .


Continue reading

Upload files using an IFRAME and save the name of the file to a database

Hello guys,I have a form that saves some data to a table. One of that field is a filename. I am using an iframe with a fileupload control to put the file on the server but I dont know how to pass the name of the file to the container form to save it to my database. Any ideas?Thanks a lot.David.
discussion1:If the IFrame is in the form itself then why cant you directly use the file upload control in the form ??If you want to learn file uploading you can check it here http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/standard/fileupload.aspx.


Continue reading

Copyright 2008