I have a routing as per below
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Now for the ID part, I'm combining many sets of data delimited by "-" character and the encrypt it with AES (RijndaelManaged) encryption. And the I UrlEncode it and send to someone email as per below...
http://localhost:7777/Product/Invite/%e3%b7%92%e4%97%ad%eb%b6%b3%e3%b7%90%eb%b2%8c%e2%aa%ad%e7%86%87%e9%b6%9e%ec%ae%aa%ec%a7%a2%ec%9a%a0%ec%ba%be%e2%89%bc%e5%ba%aa%ee%be%a8%ee%9f%a8%ea%aa%b6%e3%87%83%e3%8c%b4%eb%99%89%e8%8f%bb%e4%b0%ab%ef%bf%bd%e7%a0%99
but upon clicking it I'm getting error.
Bad Request - Invalid URL
HTTP Error 400. The request URL is invalid.
Below is the encryption and encoding process
string data1 = email.EmailID + " - /" + events.EventID + "-" + DateTime.Now.ToString("yyyyMMddhhmm") + "-" + events.MemberID;
var encoding = new UTF8Encoding(false, true);
byte[] cypherBytes = advEncryProvider.Encrypt(encoding.GetBytes(data1));
string dataEncodedString = HttpUtility.UrlEncode(GetString(cypherBytes));
Tried editing web.config as How do I enable special characters in MVC routing?
but still no luck
<system.web>
<httpRuntime targetFramework="4.5" requestPathInvalidCharacters="" requestValidationMode="2.0"/>
<compilation targetFramework="4.5" debug="true"/>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
** Update **
I managed to solve this by doing base64 encoding as suggested by Callem Pittard... :)