Monday, 26 November 2012

How to Know Request Come From which page in Asp.Net


Question:- How to Know Request Come From which page in Asp.Net
Answer:-

Uri MyUrl = Request.UrlReferrer;

 Response.Write(MyUrl);

Friday, 31 August 2012

How to call webpage from windows services in .net


using System.Net;
using System.IO; 

           string url = "http://U r Site Here";
            Uri uri = new Uri(url);
            //Create the request object
            WebRequest req = WebRequest.Create(uri);
            WebResponse resp = req.GetResponse();
            Stream stream = resp.GetResponseStream();
            StreamReader sr = new StreamReader(stream);
            string s = sr.ReadToEnd();

Tuesday, 3 April 2012

HTTP Error 500.21 - Internal Server Error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Question:-HTTP Error 500.21 - Internal Server Error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list how to solve this error

Answer:-go to Visual Studio Command Prompt with Administrator mode (Run as Administrator)

go to this location  c:\Windows\system32>%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i press enter button


now refresh you website

Friday, 30 March 2012

In Update Panel how to show alert message after click on button Asp.net

Question:-In Update Panel how to show alert message after click on button 

Answer:-
In Aspx.cs page    
ScriptManager.RegisterStartupScript(this, this.GetType(), "filesDeleted", "alert('helo')", true);

     

Tuesday, 20 March 2012

Email Error The remote certificate is invalid according to the validation procedure.

Question:- Email Error The remote certificate is invalid according to the validation procedure.

Answer:-
using System.Net.Mail;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;


// add below  code  before  send () method  like 
 SmtpClient client = new SmtpClient(); 

 ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

  client.send(msg);

      

Monday, 16 January 2012

Increase Image Size in onmouseover and onmouseout

Question:-How to Increase Image Size in onmouseover and onmouseout ?

Answer:-
<img id ="imageID" src ="http://www.dialurdoctor.com/images/DialURDoctor_logo.png" />

<script type ="text/javascript" >
   var image = document.getElementById('imageID'),
    imageWidth = image.width,
    imageHeight = image.height;
   image.onmouseover = function() {
            image.width = 2.0 * imageWidth;
            image.height = 2.0 * imageHeight;
        }
        image.onmouseout = function() {
            image.width = imageWidth;
            image.height = imageHeight;
        }
 </script>

How to retrive multiple Records with Store Procedure Using Asp.Net

Question:- How to Retrieve Multiple Records with Store Procedure using Asp.Net
Answer:-
       using System.Data.SqlClient;

      string conn = "U R Connection";
        SqlConnection con = new SqlConnection(conn);
        SqlCommand cmd = new SqlCommand("Sp_name",con);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
         DataSet ds = new DataSet();
        da.Fill(ds);