vendredi 27 octobre 2017

Make the Link NOT Editable asp.net c# Page

I have a page there is a button that generates a Link like this.

  private string GenerateLINK(string NameID)
    {

        string NameID= ds.Tables[0].Rows[0]["FName"] + " " + ds.Tables[0].Rows[0]["LName"];

        string sQS = ID+ "|" + ClientName;

        var xCrypto = new CryptoServer();
        string Vector= null;
        string sEncrypted = null;

        xCrypto.Encrypt3DES(sQS, ref sEncrypted, ref Vector);

        string sURL = sEncrypted + "#######" + Vector;
        sURL = Server.UrlEncode(sURL);
        sURL = "http://ift.tt/2zJXggo" + sURL;
        return sURL;
    }

This then gets sent to a user who clicks on it and goes to a page. Now the issue is I take the link like this and DCode it.

   private void DecryptQuerystring()
{
    var sQS = Request.QueryString["s"];
    sQS = Server.UrlDecode(sQS);

    var idelim = sQS.IndexOf("###X####", StringComparison.Ordinal);

    var sIv = sQS.Substring(idelim + 8);
    sQS = sQS.Substring(0, idelim);

    var xCrypto = new ICECrypto.CryptoServer();
    sQS = xCrypto.Decrypt3DES(sQS, sIv);

    string sID = sQS.Substring(0, sQS.IndexOf("|"));
    studentID = sID;
    Name = sQS.Substring(sQS.IndexOf("|") + 1); 
    Welcome.InnerText = "Welcome " + sQS.Substring(sQS.IndexOf("|") + 1);

}

The Problem is when the User gets there and if he puts in any word in the link it breaks the whole page showing the Server Error. I want user to NOT to be able to Edit the Link insert any thing in it. Any clue? Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire