|
What do you mean with 'launch' the pdf file?? Do you want to open it?? And do you want to open it server side, or client side??
I reckon you store the byte[] in a file and link to that file using a hyperlink...
|
|
|
|
|
thanks.
lauch mean i have to provide the option to save or open the pfd file which will create from the byte[].
Srinandan
|
|
|
|
|
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(bytePdf);
Response.Flush();
Response.End();
-- modified at 6:00 Wednesday 21st February, 2007
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
thanks sylveseter,
here is the my code snippet:
protected void btnDownloadForm_Click(object sender, EventArgs e)
{
//DataTable _dtRaiseDepositLevel = new DataTable();
//_dtRaiseDepositLevel = _objXmlHelper.getResult(_objCashier.CreateRaiseCCLimitPDF());
byte[] bytePdf = _objCashier.CreateRaiseCCLimitPDF(MerchantUser.UserName, MerchantUser.Password, (string)Session["Username"]);
char[] charPdf = new char[bytePdf.Length];
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(bytePdf);
Response.Flush();
Response.End();
}
bebugging goes successfully but i am unable to find the pdf file.
pls tell me what wrong i am doing.
Regards
Srinandan
|
|
|
|
|
you want to show download dialog or show the pdf in the browser?
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
thanks
i want to show download dialog box. but above code not show the pdf file in browser or otion like download
srinandan
|
|
|
|
|
FileStream fs = new FileStream(Server.MapPath("Filename.pdf"),FileMode.Create);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(bytePDF);
fs.Close();
// Disable caching this page (C#)
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Buffer = true;
Response.ContentType = "application/binary";
Response.AppendHeader("Content-Disposition: attachment; " +
filename=Filename.pdf");
Response.WriteFile(Server.MapPath("Filename.pdf");
Response.End();
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
Thanks Sylvester
great.
Its working fine.
Regards
Srinandan
|
|
|
|
|
You are most welcome. Please score it.
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
|
Khan_Coder wrote: Hello Sandeep,
Did u work on my issue. Did u find out the source of error.
Why would he work on YOUR problem. Surely you should be working on your problem. The people here are only here to help when they can. Not to do other people's work for them.
|
|
|
|
|
Sorry Khan
I failed to find it out Actually i similar application its working fine
<l>Thanks and Regards
Sandeep
|
|
|
|
|
Khan
i think this is not way to reply anyone ......
i tried my best and i don't know what you have done other than that you have shown
<l>Thanks and Regards
Sandeep
|
|
|
|
|
hi khan
may be you can better use the option to "delete post" or "alter it" to delete such messages posted by error..
sorry for interfering ...i hope it helps u in future...
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
hi...
how can i redirect to desired page after forms authentication is successful from the login page instead of redirecting to "default.aspx" which my application is redirecting to?
thanks for help in advance.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want always.. "
|
|
|
|
|
i am not very experienced in ASP.NET but what i would do is put the redirecting code in the pageload event of the default.aspx page. so, when a user is redirected from the login page to the default.aspx page, the code can determine where to redirect the user according to the information stored in the authentication cookie.
hope this helps.;)
|
|
|
|
|
thnks for your help and also for trying.
thts a good suggestion.but i have solved it by changing my default page which should load after login to "default.aspx" so its working .
BUT I dont want to do like that but i want to know how can i redirect to specified page .
thnks for help in advance
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
for example you have a page called "abc.aspx" which user should do login here...ok?
you need another page called "def.aspx" to appear after the user have login.
So you need to define a bool variable forexample " check " ...
then set the check ( boolean ) with ur login statement ( checking user name and password ) ...then if the "check" is true then u need to have a code there to redirect to "def.aspx"
|
|
|
|
|
thnks for suggestion
sorry ,may be i am not clear or not able to understand what you explained me.
but as u know once we turn on the forms autenticaion as successful
FormsAuthentication.RedirectFromLoginPage(userid, True)
then it redirects to "default.aspx" so we have no chance to redirect to desired page using response.redirect or any other way.
can u please explan me clearly your logic or procedure ..you may write a dummy code if u wish
thnks a lot
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
if (txtuser.Text.Trim().Length>0 && txtpass.Text.Trim().Length>0 )<br />
{ <br />
<br />
bool Success;<br />
to check if the login is true or not . your dataset should return Success ( it meants " out,bool" )<br />
if(Success)<br />
{<br />
<br />
System.Web.HttpContext.Current.Response.Redirect("WebForm2.aspx");<br />
}
|
|
|
|
|
thanks for reply,
but its not working the reason i suppose is given below
you are using response.redirect() then you not saying that the forms authentication is successful to the server without using the function
FormsAuthentication.RedirectFromLoginPage(userid, True)
so the page redirection is not working
so please suggest me any other way if possible...
thank you
-- modified at 9:29 Wednesday 21st February, 2007
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
Am having problems with the following code.
File.Delete("images\logos\" + OldFileName)
The error details that the site is trying to delete to the folder "windows\system32\inetsrv\images\logos\" which is not the correct folder. I believe this is the directory that IIS runs in. How do I get to the local folder that the website and the images folder reside in?
Thanks
|
|
|
|
|
try this
File.Delete(Server.MapPath("images\logos\" + OldFileName));
<l>Thanks and Regards
Sandeep
|
|
|
|
|
hi,
can anyone explain if it is normal for the session variable to disappear after writing to a file. if yes what can i do (work around?) to make them persist even after writing to a file.
thanks.
|
|
|
|
|
No there is no reason why this should happen.
|
|
|
|