I got this error **Redirect URI cannot contain new-line characters.** when run this below code. Am Working `MVC 4` . hers is my working code .

```
 protected void Application_Error(Object sender, System.EventArgs e)
            {
                System.Web.HttpContext context = HttpContext.Current;
                System.Exception exception = Context.Server.GetLastError();
                var stackTraceExcep = new StackTrace(exception, true); // create the stack trace
                var stackTrace = stackTraceExcep.GetFrames()         // get the frames
                              .Select(frame => new
                              {                   // get the info
                                  FileName = frame.GetFileName(),
                                  LineNumber = frame.GetFileLineNumber(),
                                  ColumnNumber = frame.GetFileColumnNumber(),
                                  Method = frame.GetMethod(),
                                  Class = frame.GetMethod().DeclaringType,
                              }).FirstOrDefault();

                string FileName = stackTrace.FileName;
                string LineNumber = stackTrace.LineNumber;
                string ColumnNumber = stackTrace.ColumnNumber;
                string MethodName = stackTrace.Method.Name;
                string ClassName = stackTrace.Class.Name;
                if (!string.IsNullOrEmpty(exception.Message))
                {
                    Response.Redirect(String.Format("~/Error/{0}/?errorMessage={1},FileName={2},LineNumber={3},ColumnNumber={4},MethodName={5},ClassName={6}", "App_Error", exception.Message, FileName, LineNumber, ColumnNumber, MethodName, ClassName));//I got this error in this line 
                }
                context.Server.ClearError();
            }

```

What Problem ? How can we solve this ? i have already searched and tried Google and get some stack overflow answers. but anything does not help me . 

Now what i do ?

My Controller action method

```
[HttpGet]
        public ActionResult App_Error(string errorMessage, string fileName, string lineNumber, string columnNumber, string methodName, string className)
        {
            string errorNumber = Convert.ToString(errorRepository.AddError(errorMessage, fileName, Convert.ToInt32(lineNumber), Convert.ToInt32(columnNumber), methodName, className));
            ViewData["message"] = "An error has occurred in the application . The error number is : " + errorNumber;
            return View();
        }

```