Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Saturday, March 31, 2012

There are so many bugs in the template of "Time Track"

There are so many bugs in the template of "Time Track", an error occured while I want to try delete a project in the project list page.

Error meesage as follows:

Server Error in '/Sample' Application.

Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.ArgumentException: Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'

Source Error:

Line 44: Protected Sub ListAllProjects_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles ListAllProjects.RowDeletingLine 45:Line 46: e.Keys.Add("Id", ListAllProjects.Rows(e.RowIndex).Cells(0).Text)Line 47: Line 48: End Sub


Source File:c:\inetpub\wwwroot\Sample\TimeTracker\Project_List.aspx.vb Line:46

Stack Trace:

[ArgumentException: Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +2836739 System.Collections.Hashtable.Add(Object key, Object value) +11 System.Collections.Specialized.OrderedDictionary.Add(Object key, Object value) +49 Project_List_aspx.ListAllProjects_RowDeleting(Object sender, GridViewDeleteEventArgs e) in c:\inetpub\wwwroot\Sample\TimeTracker\Project_List.aspx.vb:46 System.Web.UI.WebControls.GridView.OnRowDeleting(GridViewDeleteEventArgs e) +133 System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +604 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1155 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +199 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

When you add a item to a HashTable you can't have the same key, in your case all items that will be added to your Hashtable will have the "Id" as a key, make sure the key value is unique.
I knew the database constraint. I just want to say the "Time Tracker" has many bugs. Because I have not change anything in the project list page and database object.

There is no source code available for the current location

Hello,

I'm new to ASP.net and C#. I have attempted to debug one portion of our Web Application. I then edited some our code and rebuilt the project and now I cannot debug that area in the code. It says "There is no source code available for the current location" and prompts me asking if I want to view the dissambly.

What should I do?

--doc0tis

show us the source and highlite the line where your trying to set the breakpoint.

mcm

Wednesday, March 28, 2012

Thinks to be followed while working in asp.net in V2005

I am very new to V2005 .and now i have stared a new project in that anybody
who have experianced plz give me some suggestion /rules to be followed while
doing a asp.net project in V2005

Regards
PrabakarThat's a very broad question :)

There isn't anything in particular that I would suggest...except...

If you come from a classic ASP or PHP background, open your mind to doing
things differently.

I've seen many people who are new to ASP.Net and just don't get it. For
example, instead of using DataBound controls, I've seen people use for loops
and output HTML like they normally would.

ASP.NET is very different and has a big learning curve. Start small and
learn as you go...don't get discouraged :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Prabakar Samiyappan" <PrabakarSamiyappan@.discussions.microsoft.comwrote
in message news:96785518-D0A9-4294-BC72-2061F8B194EA@.microsoft.com...

Quote:

Originally Posted by

>I am very new to V2005 .and now i have stared a new project in that anybody
who have experianced plz give me some suggestion /rules to be followed
while
doing a asp.net project in V2005
>
Regards
Prabakar

Thinks to be followed while working in asp.net in V2005

I am very new to V2005 .and now i have stared a new project in that anybody
who have experianced plz give me some suggestion /rules to be followed while
doing a asp.net project in V2005
Regards
PrabakarThat's a very broad question :)
There isn't anything in particular that I would suggest...except...
If you come from a classic ASP or PHP background, open your mind to doing
things differently.
I've seen many people who are new to ASP.Net and just don't get it. For
example, instead of using DataBound controls, I've seen people use for loops
and output HTML like they normally would.
ASP.NET is very different and has a big learning curve. Start small and
learn as you go...don't get discouraged :)
Karl
http://www.openmymind.net/
http://www.fuelindustries.com/
"Prabakar Samiyappan" <PrabakarSamiyappan@.discussions.microsoft.com> wrote
in message news:96785518-D0A9-4294-BC72-2061F8B194EA@.microsoft.com...
>I am very new to V2005 .and now i have stared a new project in that anybody
> who have experianced plz give me some suggestion /rules to be followed
> while
> doing a asp.net project in V2005
> Regards
> Prabakar

Saturday, March 24, 2012

This source file has changed. It no longer matches...

I'm using VS 2003. I have a c# ASP project. Lately, when I've been running
the project in the IDE, I get a dialog which says...

"This source file has changed. It no longer matches the version of the file
used to build the application being debugged"

I've gone into the Tools/Options and went to the Debugging/Edit and Continue
and tried turning it off (I originally turned it on), shut down the project
and restarted...but I'm still getting the message intermittently.

Is there a way to stop this from happening?

Thanks

RandyThere are a couple of times when this happens. The first is if you are using
..NET test files (Team Tester or Team Suite). In these cases, rebuild works
fine.

The other is if one of the libraries was compiled in release but still has a
PDB file that matches an old version. If so, kill the PDB files before you
run again.

It is also theoretically possible that you have the temporary ASP.NET files
out of sync. If this is the case, shut down Visual Studio. Delete the
temporary ASP.NET files (%windir%\Microsoft
..NET\{FrameworkVersion}\Temporary ASP.NET files).

Are you on Vista by any chance? If so, all bets are off. Visual Studio sucks
hogs on Vista. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Randy" <temp@.temp.comwrote in message
news:O8pYJTJpHHA.1852@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

I'm using VS 2003. I have a c# ASP project. Lately, when I've been running
the project in the IDE, I get a dialog which says...
>
"This source file has changed. It no longer matches the version of the
file used to build the application being debugged"
>
I've gone into the Tools/Options and went to the Debugging/Edit and
Continue and tried turning it off (I originally turned it on), shut down
the project and restarted...but I'm still getting the message
intermittently.
>
Is there a way to stop this from happening?
>
>
>
Thanks
>
Randy
>
>

This source file has changed. It no longer matches...

I'm using VS 2003. I have a c# ASP project. Lately, when I've been running
the project in the IDE, I get a dialog which says...
"This source file has changed. It no longer matches the version of the file
used to build the application being debugged"
I've gone into the Tools/Options and went to the Debugging/Edit and Continue
and tried turning it off (I originally turned it on), shut down the project
and restarted...but I'm still getting the message intermittently.
Is there a way to stop this from happening?
Thanks
RandyThere are a couple of times when this happens. The first is if you are using
.NET test files (Team Tester or Team Suite). In these cases, rebuild works
fine.
The other is if one of the libraries was compiled in release but still has a
PDB file that matches an old version. If so, kill the PDB files before you
run again.
It is also theoretically possible that you have the temporary ASP.NET files
out of sync. If this is the case, shut down Visual Studio. Delete the
temporary ASP.NET files (%windir%\Microsoft
.NET\{FrameworkVersion}\Temporary ASP.NET files).
Are you on Vista by any chance? If so, all bets are off. Visual Studio sucks
hogs on Vista. :-)
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)
****************************************
********
Think outside the box!
****************************************
********
"Randy" <temp@.temp.com> wrote in message
news:O8pYJTJpHHA.1852@.TK2MSFTNGP05.phx.gbl...
> I'm using VS 2003. I have a c# ASP project. Lately, when I've been running
> the project in the IDE, I get a dialog which says...
> "This source file has changed. It no longer matches the version of the
> file used to build the application being debugged"
> I've gone into the Tools/Options and went to the Debugging/Edit and
> Continue and tried turning it off (I originally turned it on), shut down
> the project and restarted...but I'm still getting the message
> intermittently.
> Is there a way to stop this from happening?
>
> Thanks
> Randy
>

Thursday, March 22, 2012

Thoughts on getting away from so many aspx files....

Hi,

I have been working on a web project since the very early .net 2.0 days - around 13 months now but it seems to be getting very bulky. I have dozens of aspx files and many folders containing them! I also have way too many files in app_code.

I was thinking maybe I need single entry page - maybe written as a http handler which decides what to do and then loads content xml files to generate output. My concern here is I loose the benefits of master pages - I guess I could store all the xml files in the db but maintenance is harder then.

Any suggestions on this? What about the ever growing app_code folder?

Thanks

-c

what makes the concern for the number of files? Sure you could combine them, but isn't that going to make maintenance harder, instead of easier?

As for the pages themselves (the .aspx). If you want a different look on each, you'll have to use some custom skinning (css) and dynamic content. This will mean either lots of .css files and/or lots in the DB (or xmls) to layout each page. Not really going to save yourself anything...

As for the app_code.. same thing.. you can combine, but will it save you anything? Proper use of Master Pages, base pages and inheritance will get rid of A LOT of the code within the files, but as long as you have custom pages, you'll need the files. Dynamically adding controls can help with some reusability, but in the end its often not worth the headaches...

Thread not starting

Hi,
i am building an ASP.NET web project with J#.
I have the problem, that a Threads run() method isn't
invoked after Thread.start().
It's working in one project, but it isn't in an other one.
Are there any settings involved in this ?
regards,
grkanPlease post your code and I'll have a look.
L.
"Grkan Demirci" <fake_email@.host.de> wrote in message
news:OjlHe%23NxFHA.3756@.tk2msftngp13.phx.gbl...
> Hi,
> i am building an ASP.NET web project with J#.
> I have the problem, that a Threads run() method isn't
> invoked after Thread.start().
> It's working in one project, but it isn't in an other one.
> Are there any settings involved in this ?
>
> regards,
> grkan
>
The code is realy simple to check the behaviour.
static public volatile boolean isStarted = false;
static public void run()
{
isStarted = true;
}
protected void Application_Start(Object sender, System.EventArgs e)
{
System.Threading.Thread t = new System.Threading.Thread(new
System.Threading.ThreadStart(run));
t.set_Priority(System.Threading.ThreadPriority.Lowest);
t.Start();
while ( !isStarted );
}
run() is never been invoked. The applications hangs in while(isStarted).
regards,
grkan
"Landley" <news@.creations-software.co.uk> schrieb im Newsbeitrag
news:%23d5pBnOxFHA.2848@.TK2MSFTNGP15.phx.gbl...
> Please post your code and I'll have a look.
> L.
> "Grkan Demirci" <fake_email@.host.de> wrote in message
> news:OjlHe%23NxFHA.3756@.tk2msftngp13.phx.gbl...
>
that won't give you the results you are looking for because the application
start event only fires once. put the code in the page load event of the
webpage or leave the code where it is and re-start IIS. it should work then
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @. www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
----
"Grkan Demirci" <fake_email@.host.de> wrote in message
news:unubkzOxFHA.2976@.TK2MSFTNGP10.phx.gbl...
> The code is realy simple to check the behaviour.
> static public volatile boolean isStarted = false;
> static public void run()
> {
> isStarted = true;
> }
> protected void Application_Start(Object sender, System.EventArgs e)
> {
> System.Threading.Thread t = new System.Threading.Thread(new
> System.Threading.ThreadStart(run));
> t.set_Priority(System.Threading.ThreadPriority.Lowest);
> t.Start();
> while ( !isStarted );
> }
> run() is never been invoked. The applications hangs in while(isStarted).
> regards,
> grkan
>
> "Landley" <news@.creations-software.co.uk> schrieb im Newsbeitrag
> news:%23d5pBnOxFHA.2848@.TK2MSFTNGP15.phx.gbl...
>
My guess would be this - you set the thread's priority to lowest then you go
into a tight loop in the main thread. Should you sleep for a milli second or
two in the main thread inside the loop, then the thread should be able to
execute.
"Grkan Demirci" <fake_email@.host.de> wrote in message
news:unubkzOxFHA.2976@.TK2MSFTNGP10.phx.gbl...
> The code is realy simple to check the behaviour.
> static public volatile boolean isStarted = false;
> static public void run()
> {
> isStarted = true;
> }
> protected void Application_Start(Object sender, System.EventArgs e)
> {
> System.Threading.Thread t = new System.Threading.Thread(new
> System.Threading.ThreadStart(run));
> t.set_Priority(System.Threading.ThreadPriority.Lowest);
> t.Start();
> while ( !isStarted );
> }
> run() is never been invoked. The applications hangs in while(isStarted).
> regards,
> grkan
>
> "Landley" <news@.creations-software.co.uk> schrieb im Newsbeitrag
> news:%23d5pBnOxFHA.2848@.TK2MSFTNGP15.phx.gbl...
>

Thread not starting

Hi,

i am building an ASP.NET web project with J#.
I have the problem, that a Threads run() method isn't
invoked after Thread.start().
It's working in one project, but it isn't in an other one.

Are there any settings involved in this ?

regards,

grkanPlease post your code and I'll have a look.

L.

"Grkan Demirci" <fake_email@.host.de> wrote in message
news:OjlHe%23NxFHA.3756@.tk2msftngp13.phx.gbl...
> Hi,
> i am building an ASP.NET web project with J#.
> I have the problem, that a Threads run() method isn't
> invoked after Thread.start().
> It's working in one project, but it isn't in an other one.
> Are there any settings involved in this ?
>
> regards,
> grkan
The code is realy simple to check the behaviour.

static public volatile boolean isStarted = false;

static public void run()

{

isStarted = true;

}

protected void Application_Start(Object sender, System.EventArgs e)

{

System.Threading.Thread t = new System.Threading.Thread(new
System.Threading.ThreadStart(run));

t.set_Priority(System.Threading.ThreadPriority.Low est);

t.Start();

while ( !isStarted );

}

run() is never been invoked. The applications hangs in while(isStarted).

regards,

grkan

"Landley" <news@.creations-software.co.uk> schrieb im Newsbeitrag
news:%23d5pBnOxFHA.2848@.TK2MSFTNGP15.phx.gbl...
> Please post your code and I'll have a look.
> L.
> "Grkan Demirci" <fake_email@.host.de> wrote in message
> news:OjlHe%23NxFHA.3756@.tk2msftngp13.phx.gbl...
>> Hi,
>>
>> i am building an ASP.NET web project with J#.
>> I have the problem, that a Threads run() method isn't
>> invoked after Thread.start().
>> It's working in one project, but it isn't in an other one.
>>
>> Are there any settings involved in this ?
>>
>>
>> regards,
>>
>> grkan
>>
>>
that won't give you the results you are looking for because the application
start event only fires once. put the code in the page load event of the
webpage or leave the code where it is and re-start IIS. it should work then

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @. www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-----------------

"Grkan Demirci" <fake_email@.host.de> wrote in message
news:unubkzOxFHA.2976@.TK2MSFTNGP10.phx.gbl...
> The code is realy simple to check the behaviour.
> static public volatile boolean isStarted = false;
> static public void run()
> {
> isStarted = true;
> }
> protected void Application_Start(Object sender, System.EventArgs e)
> {
> System.Threading.Thread t = new System.Threading.Thread(new
> System.Threading.ThreadStart(run));
> t.set_Priority(System.Threading.ThreadPriority.Low est);
> t.Start();
> while ( !isStarted );
> }
> run() is never been invoked. The applications hangs in while(isStarted).
> regards,
> grkan
>
> "Landley" <news@.creations-software.co.uk> schrieb im Newsbeitrag
> news:%23d5pBnOxFHA.2848@.TK2MSFTNGP15.phx.gbl...
> > Please post your code and I'll have a look.
> > L.
> > "Grkan Demirci" <fake_email@.host.de> wrote in message
> > news:OjlHe%23NxFHA.3756@.tk2msftngp13.phx.gbl...
> >> Hi,
> >>
> >> i am building an ASP.NET web project with J#.
> >> I have the problem, that a Threads run() method isn't
> >> invoked after Thread.start().
> >> It's working in one project, but it isn't in an other one.
> >>
> >> Are there any settings involved in this ?
> >>
> >>
> >> regards,
> >>
> >> grkan
> >>
> >>
My guess would be this - you set the thread's priority to lowest then you go
into a tight loop in the main thread. Should you sleep for a milli second or
two in the main thread inside the loop, then the thread should be able to
execute.

"Grkan Demirci" <fake_email@.host.de> wrote in message
news:unubkzOxFHA.2976@.TK2MSFTNGP10.phx.gbl...
> The code is realy simple to check the behaviour.
> static public volatile boolean isStarted = false;
> static public void run()
> {
> isStarted = true;
> }
> protected void Application_Start(Object sender, System.EventArgs e)
> {
> System.Threading.Thread t = new System.Threading.Thread(new
> System.Threading.ThreadStart(run));
> t.set_Priority(System.Threading.ThreadPriority.Low est);
> t.Start();
> while ( !isStarted );
> }
> run() is never been invoked. The applications hangs in while(isStarted).
> regards,
> grkan
>
> "Landley" <news@.creations-software.co.uk> schrieb im Newsbeitrag
> news:%23d5pBnOxFHA.2848@.TK2MSFTNGP15.phx.gbl...
>> Please post your code and I'll have a look.
>>
>> L.
>>
>> "Grkan Demirci" <fake_email@.host.de> wrote in message
>> news:OjlHe%23NxFHA.3756@.tk2msftngp13.phx.gbl...
>>> Hi,
>>>
>>> i am building an ASP.NET web project with J#.
>>> I have the problem, that a Threads run() method isn't
>>> invoked after Thread.start().
>>> It's working in one project, but it isn't in an other one.
>>>
>>> Are there any settings involved in this ?
>>>
>>>
>>> regards,
>>>
>>> grkan
>>>
>>>
>>
>>

Tuesday, March 13, 2012

Thread safety issue

In my VB.Net ASP project, I have a function in a module (same thing as a
static function in C#'s terms) that is shared by all the sessions. What is
does once called is to write messages into a common log file that's also
shared by all the sessions. To make sure it is thread safe, I use the Monitor
class to sync it up. Here is the simplified version of that function"

Public Sub WriteLog(ByVal strMsg As String)
Dim oWriter As StreamWriter
Dim strLogPath As String = "C:\Logs\test.log"

If Not File.Exists(strLogPath) Then
oWriter = File.CreateText(strLogPath)
Else
oWriter = File.AppendText(strLogPath)
End If

Monitor.Enter(oWriter)
Try
oWriter.WriteLine(strMsg)
oWriter.Flush()
oWriter.Close()
Finally
Monitor.Exit(oWriter)
End Try
End Sub

My problem is that this code doesn't seem to do what I want it to do. I am
still getting error that says "The process cannot access the file
'C:\Logs\test.log' because it is used by another process.". Why is this
happening? I must be doing something wrong. Can some one tell me how I should
do this?

Thanks a million!

Fengthe object you are locking on is local to the call, so threads do not block
each other because they are all locking different objects.

you need to lock on a static object. you could use the class type, but there
is a performance hit for this, better to create an actual object to lock on.
also the File.Exists need to be in lock.

-- bruce (sqlwork.com)

"Feng" <Feng@.discussions.microsoft.com> wrote in message
news:159CE973-735B-4ED4-BC21-EA7BA0760E20@.microsoft.com...
> In my VB.Net ASP project, I have a function in a module (same thing as a
> static function in C#'s terms) that is shared by all the sessions. What is
> does once called is to write messages into a common log file that's also
> shared by all the sessions. To make sure it is thread safe, I use the
> Monitor
> class to sync it up. Here is the simplified version of that function"
> Public Sub WriteLog(ByVal strMsg As String)
> Dim oWriter As StreamWriter
> Dim strLogPath As String = "C:\Logs\test.log"
> If Not File.Exists(strLogPath) Then
> oWriter = File.CreateText(strLogPath)
> Else
> oWriter = File.AppendText(strLogPath)
> End If
> Monitor.Enter(oWriter)
> Try
> oWriter.WriteLine(strMsg)
> oWriter.Flush()
> oWriter.Close()
> Finally
> Monitor.Exit(oWriter)
> End Try
> End Sub
> My problem is that this code doesn't seem to do what I want it to do. I am
> still getting error that says "The process cannot access the file
> 'C:\Logs\test.log' because it is used by another process.". Why is this
> happening? I must be doing something wrong. Can some one tell me how I
> should
> do this?
> Thanks a million!
> Feng