小编Poo*_*oja的帖子

如何在重定向页面之前获取警报消息

我正在使用vs 2010.我需要向用户显示消息并重定向页面.

我用下面这行.

ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "<script> alert('User details saved sucessfully');window.open('frmDisplayUsers.aspx');</script>", true);
Run Code Online (Sandbox Code Playgroud)

但我没有得到警报消息,页面被直接重定向.

如何获得提醒信息?

javascript c# asp.net

12
推荐指数
1
解决办法
6万
查看次数

如何安装同一个Windows服务的多个实例

我创建了一个Windows服务器

它从Web配置文件中获取服务的名称.

我使用以下链接从webconfig获取值. http://www.codeproject.com/KB/dotnet/MultipleInstNetWinService.aspx

为了安装我的Windows服务,我只需单击该图标并再次安装,我更改配置文件中的值并重新生成我的应用程序.

我再次尝试安装,它显示已存在的指定服务的错误.

如何安装同一个Windows服务的多个实例?

谢谢,Pooja

.net windows windows-services

11
推荐指数
3
解决办法
3万
查看次数

如何使用 C# 创建自定义事件日志

我创建了一个 Windows 服务。我创建一个事件日志。

public Service1()
{
        InitializeComponent();
        this.ServiceName = ConfigurationManager.AppSettings.Get("ServiceName");

        string sourceName = ConfigurationManager.AppSettings.Get("ServiceName");
        string logName = ConfigurationManager.AppSettings["EventLogName"];
        try
        {
            if (!System.Diagnostics.EventLog.Exists(sourceName))
                System.Diagnostics.EventLog.CreateEventSource(sourceName, logName);
            eventLog.Source = sourceName;
            eventLog.Log = logName;
        }
        catch
        {
            eventLog.Source = "Application";
        }
    }
Run Code Online (Sandbox Code Playgroud)

初始化期间,会安装服务但不会创建日志。日志条目位于Application系统日志中。

我错过了什么?

我使用进程安装程序进行安装

 public ProjectInstaller()
 {
        InitializeComponent();
        this.Installers.Add(GetServiceInstaller());
        this.Installers.Add(GetServiceProcessInstaller());
 }

 private ServiceInstaller GetServiceInstaller()
 {
        serviceInstaller.ServiceName = GetConfigurationValue("ServiceName");
        serviceInstaller.Description = GetConfigurationValue("Description");
        serviceInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
        return serviceInstaller;
 }

 private ServiceProcessInstaller GetServiceProcessInstaller()
 {
        serviceProcessinstaller.Account = ServiceAccount.LocalSystem;
        return serviceProcessinstaller;
 }
Run Code Online (Sandbox Code Playgroud)

如何创建事件日志?

.net c# windows-services event-log

4
推荐指数
1
解决办法
3万
查看次数

如何将日期时间字段设置为null

我正在使用.net 4.0.我有日期时间字段的界面,如

 DateTime FromDate
    {
        get;
        set;
    }
    DateTime ToDate
    {
        get;
        set;
    }
Run Code Online (Sandbox Code Playgroud)

我想在我的用户界面中将值设置为null

IUser m_user = new User();
  m_user.FromDate = DBNull.value;
Run Code Online (Sandbox Code Playgroud)

在显示错误,就像无法将null转换为datetime.

如何将null分配给datetime?

谢谢,pooja

c# asp.net interface

1
推荐指数
1
解决办法
1926
查看次数