Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

Log-in form question

$
0
0
Imports Microsoft.AspNet.Identity
Imports Microsoft.AspNet.Identity.EntityFramework
Imports Microsoft.AspNet.Identity.Owin
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports Microsoft.Owin.Security
 
Partial Public Class Account_Login
    Inherits Page
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        RegisterHyperLink.NavigateUrl = "Register"
        OpenAuthLogin.ReturnUrl = Request.QueryString("ReturnUrl")
        Dim returnUrl = HttpUtility.UrlEncode(Request.QueryString("ReturnUrl"))
        If Not [String].IsNullOrEmpty(returnUrl) Then
            RegisterHyperLink.NavigateUrl += "?ReturnUrl=" & returnUrl
        End If
    End Sub
 
     Protected Sub LogIn(sender As Object, e As EventArgs) Handles btnLogin.Click
 
    If IsValid Then ' Validate the user password             
 
        Dim manager = New UserManager()
 
        Dim user As ApplicationUser = manager.Find(username.Text, password.Text)
 
        Try
 
            If user IsNot Nothing Then
 
                IdentityHelper.SignIn(manager, user, RememberMe.Checked)
 
                IdentityHelper.RedirectToReturnUrl(Request.QueryString("ReturnUrl"), Response)
 
            End If
 
        Catch ex As Exception
 
            FailureText.Text = ex.Message
 
            ErrorMessage.Visible = True
 
        End Try
 
    End If
 
End Sub
 
End Class
 
No error message is generated but when I complete the log-in form nothing happens after I press the Submit button.
 
When the user logs in and his credentials are validated against the database, the form should ideally disappear and
the user is sent to a Classic ASP Web site already on the WWW. That is, that particular Web site is not part of this small ASP.NET project whose pages will be 'sellotaped' onto that Classsic ASP site. (Eventually, I may try to do that site in ASP.NET but it would be too ambitious for me to try it now.)
 
How would I code that in my Login.aspx.vb file, or add to the script above, because in the script above there is no reference to a URL path as in 'when you click
on the Go/Submit button, make this log-in form disappear, and take me to www.mysite.com'?
 
Thanks for reading.

Want to send message to only connected client SignalR

$
0
0
here i got bit code for signalr and included.
client code
 
$(function () {
    // Proxy created on the fly
var chat = $.connection.chat;
 
    // Declare a function on the chat hub so the server can invoke it
    chat.addMessage = function (message) {
        $('#messages').append('<li>' + message + '');
    };
 
    $("#broadcast").click(function () {
        // Call the chat method on the server
        chat.send($('#msg').val());
    });
 
    // Start the connection
    $.connection.hub.start();
});
 
server code
 
publicclass Chat : Hub
{
    publicvoid Send(string message)
    {
        // Call the addMessage method on all clients
        Clients.addMessage(message);
    }
}
 
just see this line Clients.addMessage(message); addMessage() will invoke addMessage() function in client side but think suppose when i am sending data or message to specific client and if that is client is not connected any more then what will happen?
 
is there any provision in signalr like can we determine that client is connected before delivering data to specific client.
 
i want to detect a specific client is connected or not before sending data to client. if client is not connected then i will store data in db for that specific user. please help me with sample code that how to detect a specific client is connected or not? thanks
tbhattacharjee

Button click not trigger second time in jquery Modal popup

$
0
0
I have a Modal Popup with dynamic controls. I need to add new text box in Button click.
 
JQuery:-
 
<script type="text/javascript">
$(document).ready(function(){
if($('#hdnclick').val()==1){
$('#modelPopup').dialog({
autoopen:false,
title: "Add New Server",
width:650,
height:450,
modal:true,
buttons:{
Close:function(){
$(this).dialog('close');
}
}
});
$('#btnadd').click(function(){
alert('okay');
});
}
});
 
</script>
 
Aspx Code:-
 
<asp:GridViewID="grdservices"runat="server"AutoGenerateColumns="false"ShowFooter="true"><Columns><asp:BoundFieldDataField="S.No"HeaderText="s.no"/><asp:TemplateFieldHeaderText="service name"><ItemTemplate><asp:TextBoxID="txtservicename"runat="server"></asp:TextBox></ItemTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="description"><ItemTemplate><asp:TextBoxID="txtDescription"runat="server"></asp:TextBox></ItemTemplate><FooterStyleHorizontalAlign="right"/><FooterTemplate><asp:ButtonID="btnadd"runat="server"Text="add new service"OnClick="btnadd_Click"OnRowCommand="ButtonClicked"/></FooterTemplate></asp:TemplateField></Columns>
/asp:GridView>
 

Code Behind:-
 
protected void grdServices_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ButtonClicked")
{
hdnclick.Value = "1";
AddNewRowToGrid();
}
}
 

private void AddNewRowToGrid()
{
int rowindex = 0;
if (ViewState["CurrentTable"] != null)
{
DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
DataRow drCurrentRow = null;
if (dtCurrentTable.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
{
TextBox Box1 = (TextBox)grdservices.Rows[rowindex].Cells[1].FindControl("txtservicename");
TextBox Box2 = (TextBox)grdservices.Rows[rowindex].Cells[2].FindControl("txtDescription");
 
drCurrentRow = dtCurrentTable.NewRow();
drCurrentRow["S.No"] = i + 1;
 
dtCurrentTable.Rows[i - 1]["Column1"] = Box1.Text;
dtCurrentTable.Rows[i - 1]["Column2"] = Box2.Text;
 
rowindex++;
}
dtCurrentTable.Rows.Add(drCurrentRow);
ViewState["CurrentTable"] = dtCurrentTable;
 
grdservices.DataSource = dtCurrentTable;
grdservices.DataBind();
}
}
}
 

My Issue is this "btnAddNewServic_Click" button click fired in first click but this "btnAddNewServic_Click" function not fired in second click even anything is not fired in second click. Can anyone one help me to recover this issue..

Gray box not working after Asynchronus postback

$
0
0
when the page loads first time around, the links work as they should, opening in a Greybox popup.
 
However, if I do a partial postback , the AJS Greybox functionality is lost and clicking on the image inside update panel redirects the entire page rather than opening the target page in the Greybox popup.
 
How do we re-initialize the AJS object on every asynchronous postback.
 
string script = @"window.addEvent('domready', function() { new AJS(); })";
 
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), System.Guid.NewGuid().ToString(), script, true);
 
This script is not working.

Piro box add two iframe after asynchronous postback.

$
0
0
when the page loads first time around, the links work as they should, opening in a pirobox .
 
However, if I do a partial postback , the pirobox functionality is lost and clicking on the image inside update panel redirects the entire page rather than opening the target page in the pirobox popup.
 
then i use bellow code on my page load...
Utility.AddScriptEndRequest(this, "SetPiroBox");
 
when page asynchronous postback then show two iframe with image.
how can i remove this. please give me solutions.

Greybox popup not show properly after postback

$
0
0
when the page loads first time, the links work as they should, opening in a Greybox popup(In the Academic Calendar).
 
Domain Name- http://cpsmau.com/
 

However, if I do a partial postback (go to september month) , the AJS Greybox functionality is lost and clicking on the link it show on other page not on graybox popup.
 
Can any one help me?

How do we re-initialize the AJS object on every asynchronous postback.

string script = @"window.addEvent('domready', function() { new AJS(); })";

ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), System.Guid.NewGuid().ToString(), script, true);

This script is not working.
 
My page code is.........
 
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
      {
            DataTable dt = command.ExecuteQuery("SELECT sys_id,date, value,value3 FROM com WHERE branchCode=" + ddlSchool.SelectedValue);
            if (dt.Rows.Count > 0)
            {
                  for (int i = 0; i < dt.Rows.Count; i++)
                  {
                        if (e.Day.Date.CompareTo(Convert.ToDateTime(dt.Rows[i]["date"].ToString())) == 0)
                        {
                              if (dt.Rows[i]["value3"].ToString() == "Holiday")
                                    e.Cell.BackColor = System.Drawing.Color.DarkRed;
                              else
                                    e.Cell.BackColor = System.Drawing.Color.Green;
                              e.Cell.ForeColor = System.Drawing.Color.LightYellow;
 
                              e.Cell.Controls.Clear();
                              e.Cell.Controls.Add(new LiteralControl("<a id='A1' href='../Common/HolidayAndEventsDetail.aspx?id=" + dt.Rows[i]["sys_id"].ToString() + "', onclick='return window.open(this.href, this.target);' rel='gb_page_center[500,400]' target='_blank' style='display:block;color:white;'>" + e.Day.DayNumberText + "</a>"));
                              e.Cell.ToolTip = dt.Rows[i]["value"].ToString();
                        }
                  }
            }
      }

regex replace with double quote

$
0
0
I stumped on this one. I want to replace everything in the test text with something else.
I have this
 
Dim expDIV AsString = "(^<div id=&quot;specialFooter&quot;|ID=&quot;specialFooter&quot;)(.*)(</div>)"Dim elementDIV As System.Text.RegularExpressions.MatchCollection = _
           Regex.Matches(p_MessageXHTML, expDIV)
 
to work this the test text
<div id="specialFooter" class="default_Wrapper_Footer">Anything can be here</div>
But I can't seem to get a match with my expression. I used the actual double quotes at first, then switched to the quot;.
 
Maybe I should html encoode the input for the match first, but then I would have to encode on the replace as well.
 
Any help or suggestion would be appreciated.

How to maintain scroll position in chrome in Asp .Net

$
0
0
How to maintain scroll position in chrome in Asp .Net.
 
I write code for this ...
 
<pages theme="DarkBlue" maintainScrollPositionOnPostBack="true" asyncTimeout="50000">
 
in web.config file.
It's work in Mozilla but does't work in chrome.
Can any one help me?

Getting error while running

$
0
0
Directory Listing -- /MyWebTutorial/
 
--------------------------------------------------------------------------------
 
   Thursday, October 09, 2014 04:59 PM        <dir> bin
   Thursday, October 09, 2014 04:49 PM        <dir> Images
   Thursday, October 09, 2014 05:20 PM        <dir> JavaScript
   Thursday, October 09, 2014 06:51 PM        2,070 MasterPage.Master
   Thursday, October 09, 2014 04:18 PM          343 MasterPage.Master.cs
   Thursday, October 09, 2014 06:51 PM          782 MasterPage.Master.designer.cs
   Thursday, October 09, 2014 06:51 PM        4,968 MyWebTutorial.csproj
   Thursday, October 09, 2014 06:51 PM        1,088 MyWebTutorial.csproj.user
   Thursday, October 09, 2014 04:15 PM        <dir> obj
   Thursday, October 09, 2014 04:15 PM        <dir> Properties
   Thursday, October 09, 2014 04:28 PM        <dir> Styles
   Thursday, October 09, 2014 05:45 PM        2,014 Web.config
   Thursday, October 09, 2014 04:15 PM        1,285 Web.Debug.config
   Thursday, October 09, 2014 04:15 PM        1,346 Web.Release.config
 

--------------------------------------------------------------------------------
Version Information: ASP.NET Development Server 10.0.0.0

How to sms through asp.net website on mobile

$
0
0
Is there availbe free sms api through we can sms . using c# asp.net application

SignalR - Jquery response - 304 error

$
0
0
Dear all,
I am running the following script on the client-side and the script is failing to update, when there is change in the database. I debugged the script using web-browser debugger and discovered my Jquery scripts are responding back as "304 not modified". I am assuming the server code is sending 304 resp. if so, what tests can I carry out, to help me debug server code, to find where the logic maybe going wrong.
 
Client-side:
<script src="../Scripts/jquery-1.6.4.js"></script><scriptsrc="../Scripts/jquery.signalR-2.1.2.min.js"></script><scriptsrc='<%: ResolveClientUrl("~/signalr/hubs") %>'></script><scripttype="text/javascript">
$(function () {
    // Declare a proxy to reference the hub.          
var notifications = $.connection.NotificationHub;
    // Create a function that the hub can call to broadcast messages.
    notifications.client.recieveNotification = function (role, descrip) {
        // Add the message to the page.                    
        $('#spanNewMessages').text(role);
        $('#spanNewCircles').text(descrip);            
    };
    // Start the connection.
    $.connection.hub.start().done(function () {
        notifications.server.sendNotifications();
        alert("Notifications have been sent.");
 
    }).fail(function (e) {
        alert(e);
    });
    //$.connection.hub.start();
});
  </script><h1>New Notifications</h1><div> 
  New   <spanid="spanNewMessages"></span> = role. 
  New   <spanid="spanNewCircles"></span> = descrip.</div>
 
The server side code is created signalR hub class and also has sql dependency logic as well:
[HubName("NotificationHub")]
publicclass notificationHub : Hub
{
    string role = "";
    string descrip = "";
 
    [HubMethodName("sendNotifications")]
    publicvoid SendNotifications()
    {
        using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["##########"].ConnectionString))
        {
 
            string query = "SELECT top 1 [role],[description] FROM [dbo].[User] order by uploadDate desc";
            connection.Open();
            SqlDependency.Start(GetConnectionString());
 
            using (SqlCommand command = new SqlCommand(query, connection))
            {
 
                try
                {
                    command.Notification = null;
                    DataTable dt = new DataTable();
                    SqlDependency dependency = new SqlDependency(command);
                    dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
                    if (connection.State == ConnectionState.Closed)
                        connection.Open();
                    var reader = command.ExecuteReader();
                    dt.Load(reader);
                    if (dt.Rows.Count > 0)
                    {
                        role = dt.Rows[0]["role"].ToString();
                        descrip = dt.Rows[0]["description"].ToString();
 
                    }
 
                    connection.Close();
 
                }
 
                catch (Exception ex)
                {
                    throw ex;
                }
            }  
        }
 
        Clients.All.RecieveNotification(role, descrip);
    }
 
    privatevoid dependency_OnChange(object sender, SqlNotificationEventArgs e)
    {
        if (e.Info == SqlNotificationInfo.Insert)
 
        {
            notificationHub nHub = new notificationHub();
           nHub.SendNotifications();
 
        }
    }
 
Any hints would be very much appreciated. Many thanks

How to use JScript to get mouse position inside image?

$
0
0
I currently find where the user clicked inside an image using e.X and e.Y in an onclick method, but I'd like to show the user what he's pointing at before he clicks and does a postback to the server. Rather like a mouseover. However, I haven't been able to pick up a mouseover event with a JScript function in my .net page.
 
I barely know JScript, but I have used functions to handle onkeypress events.
 
Any pointers, articles, links or well-deserved cynical remarks?

How to get an answer to your question

$
0
0
For those new to message boards please try to follow a few simple rules when posting your question.
  1. Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
     
  2. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
     
  3. Keep the subject line brief, but descriptive. eg "File Serialization problem"
     
  4. Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
     
  5. Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
     
  6. Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
     
  7. If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
     
  8. Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
     
  9. Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
     
  10. Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
     
  11. If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
     
  12. No advertising or soliciting.
     
  13. We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
 
The Code Project Co-founder
Microsoft C++ MVP

asp.net web service error "Microsoft.Web.Services3.Security.SecurityFault: Header http://schemas.xmlsoap.org/ws/2004/08/addressing:Action for ultimate recipient is required but not present in the message."

$
0
0
I am getting the following error
 
<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><soap:Header><wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action><wsa:MessageID>urn:uuid:13dee3e0-d36f-4b94-b769-d981fe391ed8</wsa:MessageID><wsa:RelatesTo>urn:uuid:a506294f-dea5-4ada-b1b2-a3677e00dcce</wsa:RelatesTo><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsse:Security><wsu:Timestampwsu:Id="Timestamp-0b0b00f2-2c73-47cb-b951-0f2f8f555dd8"><wsu:Created>2014-10-12T20:04:40Z</wsu:Created><wsu:Expires>2014-10-12T20:09:40Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><soap:Fault><faultcodexmlns:q0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">q0:Security</faultcode><faultstring>Microsoft.Web.Services3.Security.SecurityFault: Header http://schemas.xmlsoap.org/ws/2004/08/addressing:Action for ultimate recipient is required but not present in the message.
   at Microsoft.Web.Services3.Design.RequireSoapHeaderAssertion.RequireSoapHeaderFilter.ProcessMessage(SoapEnvelope envelope)
   at Microsoft.Web.Services3.Pipeline.ProcessInputMessage(SoapEnvelope envelope)
   at Microsoft.Web.Services3.WseProtocol.FilterRequest(SoapEnvelope requestEnvelope)
   at Microsoft.Web.Services3.WseProtocol.RouteRequest(SoapServerMessage message)
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)</faultstring><faultactor>http://localhost:4190/AeslPSWebService.asmx</faultactor></soap:Fault></soap:Body></soap:Envelope> 

and my request is as follows
 
<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><_0:Securitysoap:actor="www.toromont.com"soap:mustUnderstand="true"xmlns:_0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"xmlns:_0_1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><_0_1:Timestamp_0_1:Id="Timestamp-135"><_0_1:Created>2014-10-10T13:48:35.832Z</_0_1:Created><_0_1:Expires>2014-10-19T13:53:35.832Z</_0_1:Expires></_0_1:Timestamp><_0:UsernameToken_0_1:Id="UsernameToken-136"><_0:Username>sa</_0:Username><_0:PasswordType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Allied@CAT</_0:Password></_0:UsernameToken></_0:Security><par:UserCredentialsxmlns:par="http://www.cat.com/MT/2008/11/15/PartStoreRequiredService"/></soapenv:Header><soapenv:Body><se:getCustomerInformationxmlns:se="http://www.cat.com/MT/2008/11/15/PartStoreRequiredService"xmlns:xsd="http://customerlookup.partstore.domain.webservice.midtier.websolutions.dcs.cat/xsd"><se:custLookUpInput><xsd:custNo>99008</xsd:custNo><xsd:custTypexsi:nil="true"/><xsd:dealerCode>X130</xsd:dealerCode></se:custLookUpInput></se:getCustomerInformation></soapenv:Body></soapenv:Envelope> 
I have developed this web service for our vendor based on the wsdl they provided. Please help as i am unable to find any solution of it.

How to embed a video in my c# based dot net website which should be compatible in all browsers especially chrome.

$
0
0
I had developed a dot net website in c#.I want to embed a video in my website,which should be compatible in all browsers without using html5.I had tried but the video is playing or compatible on IE only.What should i do.please provide some suggestions or code.I will be grateful to you.

Regarding Self hosting SignalR Application in Win Service

$
0
0
i was just reading a article on Self hosting SignalR Application in Win Service from this url http://damienbod.wordpress.com/2014/06/03/signalr-self-hosting-template-for-a-windows-service/
 
code was not very clear to me.so here i am pointing out those line of code point wise. apologized for bit big question.
 
namespace SignalREngineServiceWindowsService
{
    staticclass Program
    {
        ///<summary>/// The main entry point for the application.
///</summary>staticvoid Main(string[] args)
        {
            // Remove this if you want to test as a console application and add an arg
            ServiceBase.Run(new SignalREngineServiceWindowsService());
 
            if (args != null)
            {
                try
                {
                    Startup.StartServer();
                    Console.ReadKey();
                }
                finally
                {
                    Startup.StopServer();
                }
            }
        }
    }
}
 
[assembly: OwinStartup(typeof(Startup))]
 
namespace SignalREngine
{
    publicclass Startup
    {
        static CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
 
        // Your startup logic
publicstaticvoid StartServer()
        {
            var cancellationTokenSource = new CancellationTokenSource();
            Task.Factory.StartNew(RunSignalRServer, TaskCreationOptions.LongRunning
                                  , cancellationTokenSource.Token); 
        }
 
        privatestaticvoid RunSignalRServer(object task)
        {
            string url = "http://localhost:8089";
            WebApp.Start(url);
        }
 
        publicstaticvoid StopServer()
        {
            _cancellationTokenSource.Cancel();
        }
 
        // This code configures Web API. The Startup class is specified as a type
// parameter in the WebApp.Start method.
publicvoid Configuration(IAppBuilder app)
        {
            app.Map("/signalr", map =>
            {
                map.UseCors(CorsOptions.AllowAll);
                var hubConfiguration = new HubConfiguration
                {
                };
 
                hubConfiguration.EnableDetailedErrors = true;
                map.RunSignalR(hubConfiguration);
            });
        }
    }
}
 
1) just see this line...what is the meaning
 
ServiceBase.Run(new SignalREngineServiceWindowsService());
 
how we can instantiate namespace because this is the namespace name SignalREngineServiceWindowsService i think we should specify the class name...what u say!
 
2)
 
public static void StartServer()
{
var cancellationTokenSource = new CancellationTokenSource();
Task.Factory.StartNew(RunSignalRServer, TaskCreationOptions.LongRunning
, cancellationTokenSource.Token);
}
 
here we are calling a method with TPL but what is the meaning of this option or param TaskCreationOptions.LongRunning and cancellationTokenSource.Token ?
 
3)
 
private static void RunSignalRServer(object task)
{
string url = "http://localhost:8089";
WebApp.Start(url);
}
 
see this url string url = "http://localhost:8089"; here can't we specify machine IP where self host apps will run? is it mandatory to write like localhost ?
 
4)
 
public static void StopServer()
{
_cancellationTokenSource.Cancel();
}
 
what will happen when this line will be invoked _cancellationTokenSource.Cancel(); ?
 
how it can stop the signalr hub ?
 
5)
 
public void Configuration(IAppBuilder app)
{
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration
{
};
 
hubConfiguration.EnableDetailedErrors = true;
map.RunSignalR(hubConfiguration);
});
}
 
who will call Configuration() function because i found no routine in code from where Configuration() will be called ?
 
6) RunSignalR() ? is any built-in function ?
 
7) what is the difference between this line map.RunSignalR(hubConfiguration); and map.MapSignalR(); ?
 
8) i found another approach to point out the startup class....here it is
 
staticvoid Main(string[] args)
{
            string url = "http://localhost:6118";
            using (WebApp.Start<Startup>(url))
            {
                Console.WriteLine("The Server URL is: {0}", url);
                Console.ReadLine();
            }
}
 
class Startup
{
public void Configuration(IAppBuilder MyApp)
{
MyApp.MapSignalR();
}
}
 
what is Startup class & what it does or what its role in self hosting ?
 
i just go through a article and after reading it lots of confusion occur. so i just need answer for my question. so it will be great if some one answer point wise.
 
here i am including few more url which also talk about signalr selfhost but their coding approach is bit different but understandable.
 
here is those url
http://www.c-sharpcorner.com/UploadFile/4b0136/introduction-of-Asp-Net-signalr-self-hosting/

https://code.msdn.microsoft.com/windowsapps/SignalR-self-hosted-in-6ff7e6c3

http://www.dotnetcurry.com/showarticle.aspx?ID=918
tbhattacharjee

Is there a way to capture all the page records in jqgrid when exporting to excel

$
0
0
But only the data in current grid was captured using the following method
 
mya=jQuery(”#list2″).getDataIDs(); // Get All IDs"
 
If I like to export all data (e.g. totally 18 records, 10 displayed in current grid and 8 in second grid page), is there a way to capture all 18 records without invoking the backend?
 
i am not finding any solution only first page data is capturing in excel ...
I am using
var jqgridRowIDs = $(tableCtrl).getDataIDs(); // Fetch the RowIDs for this grid
var allJQGridData = $(tableCtrl).jqGrid('getRowData');
var headerData = $(tableCtrl).getRowData(jqgridRowIDs[0]);

Plz help me out.....

My code is not working while using with updatepanel.The ddl selected item it coming blank whiule printing before using update panel it was coming.

$
0
0
<scripttype="text/javascript"language="JavaScript">function PrintPage(pageheader) {
                var wPageHeader = pageheader
                var curDate;
                var advNo='<%=ddlAdvertise.selecteditem.text%>';
                var post='<%=ddlPost.selecteditem.text%>';
 

                var wOption = "width=875,height=525,menubar=yes,scrollbars=yes,location=no,left=20,top=20";
                var wWinHTML = document.getElementById('printArea1').innerHTML;
                var wWinPrint = window.open("", "", wOption);
 
                wWinPrint.document.open();
                wWinPrint.document.write("<html><head><link href='../Styles/Print.css' rel='stylesheet'><title>e-Despatch</title></head><body>");
                wWinPrint.document.write("<div id='header'><div style='float:center;margin-top:10px;'></div> <div style='float:center; margin-top:0px;' width='220'>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <b> Advertisement No:"+advNo+"</b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <b> Post Code:"+post+"</b></div><div style='float:center;margin-top:0px;'><b>"+wPageHeader+"</b></div><div style='float:right' align='right'><div align='right' id='printDate'></div></div><div style='clear:both'></div></div>")
                //wWinPrint.document.write("<div align='center' id='printHeader'>" + wPageHeader + "</div>");
//wWinPrint.document.write("<div align='right' id='printDate'>"+curDate+"</div>");
                wWinPrint.document.write(wWinHTML);
                wWinPrint.document.write("</body></html>");
                wWinPrint.document.close();
                wWinPrint.focus();
}
    </script>

Passing GUID to a function

$
0
0
public DataSet ReadPreviousProperty(Guid appIDValue)
{
DataSet ds1 = new DataSet();
try
{
con = new SqlConnection(connectionString);
SqlDataAdapter da1 = new SqlDataAdapter(); ;
SqlCommand cmd1 = new SqlCommand("[sp_ReadPreviousProperty]", con);
cmd1.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ApplicationID", SqlDbType.UniqueIdentifier).Value = appIDValue;
if (con.State == ConnectionState.Closed)
con.Open();
da1.SelectCommand = cmd1;
da1.SelectCommand.Connection = con;
da1.Fill(ds1, "tblPropertyMaster");
 
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}
finally
{
if (con.State == ConnectionState.Open)
con.Close();
}
return ds1;
 
}
 
cmd.Parameters.Add("@ApplicationID", SqlDbType.UniqueIdentifier).Value = appIDValue;
this line raises error ,object reference is not set to an instance
please check my code and answer

popup issue for showModalDialog

$
0
0
<pre lang="sql">Scenario is I have one parent and on child page. Child page contain list of say countries. I was using showModalDialog function in java script which is easily returned the value I had selected in my child page. Recently this functionality is not working in chrome as in new update they have deprecated showModalDialog function. Please suggest me some alternative to achieve this.
I tried same using different methods but issue I am facing is there are multiple values returning from child which I have to split and assign to my hidden values in parent:</pre>
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>