コード例 #1
0
    protected void resendbtn_Click(object sender, EventArgs e)
    {
        try
        {
            if (!String.IsNullOrWhiteSpace(Request.QueryString["m"]))
            {
                string          aa       = clsCommon.strApiUrl + "/api/Login/SendOtp?mobile_number=" + clsCommon.Base64Decode(Request.QueryString["m"]);// + jobcard + "&UserId=" + userId;
                HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(aa);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream       receiveStream = response.GetResponseStream();
                    StreamReader readStream    = null;

                    if (response.CharacterSet == null)
                    {
                        readStream = new StreamReader(receiveStream);
                    }
                    else
                    {
                        readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                    }
                    string data = readStream.ReadToEnd();
                    if (!String.IsNullOrEmpty(data))
                    {
                        clsModals.clsSendOtpResponce objSendOtpResponse = JsonConvert.DeserializeObject <clsModals.clsSendOtpResponce>(data);
                        if (objSendOtpResponse.response.Equals("1"))
                        {
                            //if (!string.IsNullOrWhiteSpace(Request.QueryString["offercode"]))
                            //{
                            //    Response.Redirect("~/verify.aspx?offercode=" + Request.QueryString["offercode"]);
                            //}
                            //else
                            //{
                            //    Response.Redirect("~/verify.aspx");
                            //}

                            if (!string.IsNullOrWhiteSpace(Request.QueryString["fcode"]))
                            {
                                Response.Redirect("~/verify.aspx?fcode=" + Request.QueryString["fcode"]);
                            }
                            else
                            {
                                Response.Redirect("~/verify.aspx");
                            }
                        }
                    }
                }
            }
            else
            {
                //if (!string.IsNullOrWhiteSpace(Request.QueryString["offercode"]))
                //{
                //    Response.Redirect("~/register.aspx?offercode=" + Request.QueryString["offercode"]);
                //}
                //else
                //{
                //    Response.Redirect("~/register.aspx");
                //}

                if (!string.IsNullOrWhiteSpace(Request.QueryString["fcode"]))
                {
                    Response.Redirect("~/register.aspx?fcode=" + Request.QueryString["fcode"]);
                }
                else
                {
                    Response.Redirect("~/register.aspx");
                }
            }
        }
        catch (Exception ex)
        {
            objDbConnection.InsertErrorLogs(ex.Message + " :: " + ex.StackTrace);
        }
    }