ASP.NET Why is this shortening url code redirecting to page -
hey have following method
public static string getshortenedurl(string inurl) { string shorturl = ""; string queryurl = "http://api.bit.ly/shorten?version=2.0.1&longurl=" + inurl + "&login=&apikey="; httpwebrequest request = webrequest.create(queryurl) httpwebrequest; using (httpwebresponse response = request.getresponse() httpwebresponse) { streamreader reader = new streamreader(response.getresponsestream()); string jsonresults = reader.readtoend(); int indexofbefore = jsonresults.indexof("shorturl\": \"") + 12; int indexofafter = jsonresults.indexof("\"", indexofbefore); shorturl = jsonresults.substring(indexofbefore, indexofafter - indexofbefore); } return shorturl; }
which worked fine on development machine, on live server reason whenever call method seems visit url aswell. reason why problem because url updates status of record. want when user clicks on link in mail weird reason when im creating email on confirmation page of registration , call shortened url method can add short url in mail send out, seems visit itself. hence updating status when shouldnt yet.
any ideas ?
edit : how call it
emailbody.append(m1utils.getshortenedurl(configurationsettings.appsettings["strsite_feurl"].tostring() + "login/verify.aspx?" + strencrypted)).append("\r\n\r\n");
Comments
Post a Comment