Hi guys, I'm having some trouble opening a pdf file when a gridbuttoncolumn is pressed. This is my code I have to open it
But when I run it I get the next error message "The relative virtual path 'http:/localhost:50422/docs/28-grant application.pdf' is not allowed here." I save the file previously and now I want to open it but I can't do'it. Can you point me to the right direction please.
This is my code to save the document.
if (e.CommandName == "Ver")
{
string Servidor = Request.Url.GetLeftPart(UriPartial.Authority);
string fullUrl = Servidor + Session["strUrl"];
OpenFile(fullUrl);
}
This is my code to save the document.
var usuarioSesion = (Usuario)Session["usuarioSesion"];
var dbContext = new BD_SSEGUAEntities();
string strUrl;
int exp = Convert.ToInt32(Session["ExpEmp"]);
int folio = Convert.ToInt32(Session["Foliosol"]);
var newDoc = new Documento();
foreach (UploadedFile file in RadUpload1.UploadedFiles)
{
// var ResultSol = new Solicitud();
var fileName = folio + "-" + file.GetName().ToLower();
file.SaveAs(MapPath(@"~/docs/" + fileName));
strUrl = "/docs/" + fileName;
//MapPath(@"/docs/")+file.GetName();// + ResultSol.fiIdSolicitud + "-" +
if (RadUpload1.InvalidFiles.Count == 0 && RadComboBox1.SelectedValue!=null )
{
try
{
var doc = new Documento
{
fiIdSolicitud = folio,
fiAnioSolicitud = (short) DateTime.Now.Year,
fiIdTipoDocumento = (byte) TipoDoc,
fiIdEdoDocto = 1,
fdFchRegDocto = DateTime.Now,
fiUsrRegDocto = usuarioSesion.Expediente,
fcURLdocumento = strUrl,
};
dbContext.Documento.AddObject(doc);
dbContext.SaveChanges();
Alerta("El documento se guardó de forma correcta");
}
catch (Exception ex)
{
Alerta(ex.Message);
}
llenaGridDocs();
}
else
{
Alerta("Captura los todos los datos");
}
// else
//{
// Alerta("Agrega un documento");
//}
}
}