.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Write to event log doesnt work

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :SharePoint

Hello, this code works perfect, but when I check the event log I cant see the log, I checked all logs


 SPDiagnosticsService diagSvc = SPDiagnosticsService.Local;
        diagSvc.WriteTrace(0, // custom trace id
            new SPDiagnosticsCategory("My category",
                EventSeverity.Error), // create a category
            TraceSeverity.Monitorable, // set the logging level of this record
            "Writing to the ULS log:  {0}", // custom message
            new object[] { "SharePoint rocks!" } // parameters to message

        diagSvc.WriteEvent(0,// custom trace id
            new SPDiagnosticsCategory("General",

View Complete Post

More Related Resource Links

Write to event log doesnt work


Hello, this code works perfect, but when I check the event log I cant see the log, I checked all logs


 SPDiagnosticsService diagSvc = SPDiagnosticsService.Local;
        diagSvc.WriteTrace(0, // custom trace id
            new SPDiagnosticsCategory("My category",
                EventSeverity.Error), // create a category
            TraceSeverity.Monitorable, // set the logging level of this record
            "Writing to the ULS log:  {0}", // custom message
            new object[] { "SharePoint rocks!" } // parameters to message

        diagSvc.WriteEvent(0,// custom trace id
            new SPDiagnosticsCategory("General",

C++ at Work: Event Programming, Part 2


Last month I answered a question about implementing native events in C++ (see C++ At Work: Event Programming). I discussed events in general and showed how to use an interface to define event handlers for your class that clients must implement to handle events.

Paul DiLascia

MSDN Magazine March 2006

file upload in Create User Wizard Created User event with UpdatePanel Tag wont work?



In my Create User Wizard1 Created User Wizard Event, I am collecting extra information from text boxes and allowing

the user to uplad a file.



I have put the Submit button within an Update Panel Tag but since I have done this it does not work.

Is there a way round it. In this situation would you use a trigger.?


<br />

  <asp:UpdatePanel ID="UpdatePanel2" runat="server">

  <asp:Button ID="StepNextButton" runat="server"  CommandName="MoveNext"  align="middle"
                                            Text="Submit my Profile" />

How to write an event to manage permissions on a document while uploading, depending on custom field



I am trying to find a solution to manage permissions on a document, while uploading it into a document library. This event has to be fired if a custom field is populated (it's a check box field).

How to write an event for this, i tried writing ItemAdded event, but this is getting fired as soon as a document is uploaded, before coming to the page, where we populate all the fields and hit check in.

can i capture Check-in event.

Please advise.


How to get Click event to work with checkbox


I am new to ASP.Net and I'm having trouble figuring out what needs to be where in my code.  I have a webform with 2 listboxes and 2 checkboxes... When I check checkbox1 I want listbox1 to be disabled and checkbox2 to be disabled.  Similarly, when I check checkbox2 I want listbox2 to be disabled and checkbox1 to be disabled.  The code does not show any errors; however, when I run the Page everything appears as it is supposed to but when I check the boxes, nothing happens.  What am I missing that will link the code on the .aspx.vb page to the objects on the .aspx page and make them work together?

Here is my code for Page1.aspx.vb:

Public Class LCPage1
    Inherits System.Web.UI.Page

    Protected Sub AllClients_Click(ByVal sender As ObjectByVal e 

Getting AppDomain.UnhandledException event to work in a Windows Service

Nearly every forum thread I have found on "catching unhandled exceptions in a service" seems to end up where I am.  The supposed solution is the use of the AppDomain.CurrentDomain.UnhandledException event.  But it doesn't work for someone, who then asks why and gets no answer.  Same for me; I can't get the event to happen.  It's as if I need the ServiceProcess version of Application.SetUnhandledExceptionMode(), which doesn't exist. For diagnosing this, I start a timer in a child object of the service and then throw an exception in the timer event handler.  Simple enough to simulate the real situation.  I have tried subscribing to the UnhandledException event in at least a half dozen locations throughout the service, from the Program that runs ServiceBase.Run() to the constructor of the object that owns the Timer, but it never catches this exception. The VS debugger recognizes that the forced exception is unhandled and takes me to the place where is thrown, letting me know it is an unhandled exception. Why doesn't my handler catch it?  Running without the debugger, the exception throws, the timer thread crashes, the service continues merrily along, and nothing gets logged anywhere.  That is NOT the result I need.  What are the people for whom this works doing that I am not doing? How can I at least get the offe

textChanged event doesnot work

hi friend TextChanged event for a textbox doesnot work when i change the text inside the textboxi added this code to textchanged event method in my website code-behindprotected void passwordTxt_TextChanged(object sender, EventArgs e)        {            char[] pass = passwordTxt.Text.ToCharArray();            for(int i=0;i<pass.Length;i++)            {                if (Char.IsDigit(pass[i]))                    digit++;                else if (Char.IsLetter(pass[i]))                    letter++;            }            if (digit >= 1 && letter >= 1)                errorPassLbl.Text = "Strong";        

not able to write log messages in event log on windows 2008 server

Hi, I am trying to write in Event Log on windows 2008 server with a windows service application. But I got this error: Service cannot be started. System.ComponentModel.Win32Exception: The parameter is incorrect at System.Diagnostics.EventLog.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName) at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) at Siemens.SHS.Utilities.Common.LogManager.LogToEvent(String pLogName, String pSource, String logEntry, EventLogEntryType type) at Siemens.SHS.PEP.TaskCore.StartTask(String pPluginFilePath) at Siemens.SHS.PEP.TaskCore.RecurseStart(String pPluginPath) at Siemens.SHS.PEP.TaskCore.RecurseStart(String pPluginPath) at Siemens.SHS.PEP.TaskCore.StartTasks() at Siemens.SHS.PEP.PlugnExecute.OnStart(String[] args) at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)How can I write to Event Log on x64 platform as Windows 2008 server?Any help appreciated, thanks in advance,Cigdem

SharePoint workflow Enable WorkflowModification doesnt work

Hi   I'm trying to enable WorkflowModification in a sequential workflow in VS Studio 2008 according to the *** of examples of microsoft but When I run my workflow I get this error: 09/14/2010 10:24:35.78  w3wp.exe (0x11FC)                        0x13A8 Windows SharePoint Services    Workflow Infrastructure        88xr Unexpected WinWF Internal Error, terminating workflow Id# 74f4bd77-7aaa-407e-90ac-f56a6184bc21  09/14/2010 10:24:35.78  w3wp.exe (0x11FC)                        0x13A8 Windows SharePoint Services    Workflow Infrastructure        98d4 Unexpected System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.SharePoint.SPException: Error in the application.     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.EnableWorkflowModification(Guid modificationId, String contextData)     --- End of inner exception stack trace ---     at System.RuntimeMethodHandle._InvokeMe

Modal popup with button click event won't work

Hi all,I try to create a asp.net 4 webpage, using masterpage.On webpage I have a formview and inside the formview I have a ajax modalpopup. I have multiple buttons and textboxes on the modalpopup, and created a test event, but I still get the message that the textbox is not declared.Here is how the code is set at this point:<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <style type="text/css"> .ModalPopupBG { background-color: #666699; filter: alpha(opacity=50); opacity: 0.7; } .popup_Container { background-color:#fffeb2; border:2px solid #000000; padding: 0px 0px 0px 0px; } .HellowWorldPopup { min-width:200px; min-height:150px; background:white; } .popup_Titlebar { background: url(../Styles/titlebar_bg.jpg); height: 29px; } .popup_Body { padding:15px 15px 15px 15px; font-family:Arial; font-weight:bold; font-size:12px; color:#000000; line-height:15pt; clear:both; padding:20px; } .TitlebarLeft { float:left; padding-left:5px; padding-top:5px; font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px; color:#FFFFFF; } .TitlebarRight { background:url(../Styles/cross_icon_normal.png); background-position:right; background-repeat:no-repeat; height:15px; width:16px; float:right; cursor:pointer; margin-right:5px; margin-top:5px;

FormView doesnt call itemupdating event?


Hello all,

So, to sum is up, I have a FormView:

        <asp:FormView ID="fvSubscriptionEdit" DefaultMode="Edit" runat="server" GridLines="None"
            CssClass="SubEditPanel" OnItemUpdating="fvSubscriptionEdit_ItemUpdating">
                    Abonnement wijzigen</h2>
                <asp:HiddenField runat="server" ID="hfSubscriptionId" Value='<%# Bind("SubscriptionId")%>' />
                <asp:Label runat="server">Type wijzigen</asp:Label>
                <asp:DropDownList ID="ddlTypeEdit" runat="server" SelectedValue='<%# Bind("SubscriptionType")%>'>
                    <asp:ListItem Text="- Kies -" Value="1" />
                    <asp:ListItem Text="Upgrade" Value="upgrade" />
                    <asp:ListItem Text="Verlengen" Value="verlengen" />
                <hr />
                    Credits wijzigen</h2>
                <asp:Label runat="server">Nieuw aantal credits</asp:Label>

not able to write error to event log and log file



I am using entlib 5.0 and framewokr 3.5(vs.net 2008)

I opened entlib console and open the webconfig file and added the listeners and my webconfig file is as below

<?xml version="1.0"?>
  <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServi

Sendmessage doesnt work in ASP VB IIS6



I have an ASP page, that sends data for a local Application on the server...

in my PC which the OS is win XP 32bit ... it works just fine

in the server which is windows server 2008 64bit , with IIS 6

nothing really happens when i send the message in the server, no errors, no data ...   nothing

just like iam pressing a button with no code to handle...!!!!

please , try help me with an answer

Multiselection in Excel filter doesnt work for my calculation

Dear all,

I'm having a problem with one of my calculations. It's working perfecty for one selected unit (e.g. year '2010', or quarter 'Q2' for year 2010, or month 'july' for year 2010).
But, in my report in Excel, I MUST have option to select multiple values of date (e.g. quarter 'Q1' and 'Q2', or months 'january' and'february') because some other of my calculation needs multiple values of date. 

What I need is to tell me how to change my calculation when I chose multiple values of date? Is it even posible?
-if you select five months: 'january', 'february', 'march', 'april', 'may' then I want last month 'may' to be saved in some variable (or if there is some other method, even better) that can be used for making SUM of Amount on period (from begining to latest selected date) described in code below. 

[Date].[Year - Quarter - Month - Date].CurrentMember,
[Date].[Year - Quarter - Month - Date].[Year]

IIF([Date].[Year - Quarter - Month - Date].CurrentMember.Level.Name="Year" 

Wrap a control that doesnt have a click event so click event is possible



I have a flash control like the code below. It seems that this control doesn´t have any click event.

So my question is if it is possible to execute some code when this flash control is clicked. In this case there is a flash movie in this control.

Would it be possible to wrap this control with another control and here have the possibility to use some C# code in any way?


<Bewise:FlashControl ID="FlashControl1" runat="server" Width="420px" 
                        Height="47px" Loop="True" 
                        MovieUrl="movie.swf" Visible="False" WMode="Opaque" />


WPF ComboBox Style/Template example from MSDN doesnt work if "IsEnabled"=false?



I am using a customized look of the WPF combobox control with the help of the msdn Style and Combox Template example taken from here: http://msdn.microsoft.com/en-us/library/ms752094.aspx

I copied that code and I can use the control just fine, but as soon as you set the combobox attribute "IsEnabled" to false, you always get an error warning in Visual Studio 2010 Designer view with the following message:

'System.Windows.Media.Animation.ColorAnimationUsingKeyFrames' animation object cannot be used to animate property 'Foreground' because it is of incompatible type 'System.Windows.Media.Brush'.

Actually I have no idea on how to fix this error. Does anyone have an idea what is causing this error? Since its an msdn example everyone should encounter this error when disabling the control with this template example?

Thanks in advance for your help, kind regards,

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend