Response.TransmitFile is not opening the links directly from SharePoint Library c#

Hi,
 I want to open a pdf file from a sharepoint library. I am using Response.TransmitFile to do that. But it throws me the error "'url' is not a valid virtual path". Is there anyway otherway to do this.
            Response.Clear();
            Response.ClearHeaders();            
            Response.ContentType = "application/pdf";
            Response.TransmitFile("URL to the library" + fileName);
            Response.Flush();
            Response.End();

try using this method. In a standard .NET application what your doing may work but SharePoint works different as all the files are stored in the database.
private void OpenDocument(SPListItem listItem)
SPFile file = listItem.File;
using (MemoryStream ms = new MemoryStream(file.OpenBinary()))
Response.Clear();
// Clear the content of the response
Response.ClearContent();
Response.ClearHeaders();
// Buffer response so that page is sent after processing is complete.
Response.BufferOutput = true;
// Add the file name and attachment, which will force the open/cance/save dialog to show, to the header
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
// Add the file size into the response header
Response.AddHeader("Content-Length", file.Length.ToString());
// Set the ContentType - octet stream helps handle all content types generically
Response.ContentType = "application/octet-stream";
ms.WriteTo(Response.OutputStream);
Response.Flush();
Response.Close();
Microsoft Certified Technical Specialist
EmpowerCS (Australia) for all your CRM/SharePoint needs.
SharePointBlogger.Net
Hi, Thanks for the reply. I didn't tested this, but when I do I will let you know the feedback.
For me "Response.Redirect" worked for now as a I am saving the document into library and then opening it.

Similar Messages

  • Can't open CUP link directly from email notification ( GRC 5.3 )

    Hi Everybody,
    I am working for a client where GRC 5.3 is installed.
    When we submit a user request in CUP , a link is automatically generated in a mail and send to the manager/ approver based on the workflow. But the problem is that client is not able to open the link directly from the mail. They need to open it everytime manually through browser. This happens in Dev system only. Where as in Prd system they do not face any issue. They can directly open link from mail automatically send from CUP.
    Can someone guide where is the problem in terms of setting because Dev and Prd is behaving different way.We are unable to find exact location where we need to make change in Dev grc. Please help.
    Regards,
    Kakali

    Hi Kakali,
       You must have different configuration Dev and Prd. Can you check the application and redirection URL link under SMTP server link? I think the problem resides there as CUP uses those links in the email.
    Regards,
    Alpesh

  • Left click on a link does not open the link; a small blue window opens saying loading then closes.

    Left click on any link in a web page does not open the link. A very small blue window appears with the word loading and a few moving dots. In a few seconds the blue window closes but the link does not open. Links used to open. If I right click the link, I can open the link in a new window. Many new windows pile up. This is a nuisance.
    I am using Firefox 3.6.8 for Canonical 1.0 in Ubuntu 9.10.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the ''Safe mode'' start window.
    You have to close and restart Firefox after each change via "File > Exit" (on Mac: "Firefox > Quit")

  • When I click links in emails, it will not open the link in my default browser (Firefox)

    Have worked through all of the suggestions here and still not working : https://support.mozilla.org/en-US/kb/hyperlinks-in-messages-not-working?esab=a&as=aaq
    Any ideas?
    Thanks

    hi, i did what matt suggested and started my mac in safe mode....the links worked well in safe mode....when i checked them after booting up normally, the links worked for a time, not long, and now they no longer work
    what is happening with me, when i click on a link in tb, firefox will open to the proper link, however, if firefox is already open the link will just bring up the firefox browser and not the link....i have to close firefox and then click on the link and firefox will then open to the proper window......
    any help would be appreciated
    this seemed to happen right after i installed the OS bash update.

  • Why do email hyperlinks open a new ff browser, but will not open the link?

    '''''''''XPSP3 & FF3.6 & Outlook2003''''''''' : When I click on a hyperlink in outlook, a fresh occurence of ff opens (even though ff is already open) but the link will not open. This used to work before I upgraded to ff4.0, so I rolled back to 3.6 and still have the same problem. All the file type suggestions have been executed, but still no success. Can anyone offer any help?

    The '''SearchToolbar/1.2''' that messed with your UserAgent might be the cause of that problem. Try some troubleshooting.
    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • Why does Firefox not open the link in an email message?

    Since upgrading to 3.6.10 (at least I think since then) Firefox no longer opens the urls in email messages when I click on them. Firefox becomes active, but then nothing happens. How can I rectify this? I use mail.app, on Mac OS 10.6.5.
    Thanks,
    Adriaanh

    Ok, well I found it quickly without really finding the source of the problem. I created my account here in order to post this problem, and when I received the account confirmation email to activate my account, clicking the hotlink opened a browser window WITHOUT the address! So I restarted firefox and lo and behold, I could confirm my account via the hotlink and dvd@ccess now works, even in the dvd studio pro simulator. Why this bug appeared remains to be answered. Thanks and good luck.

  • I have updated my PSE9 and still can not open the RAW files from my new camera, I get an error?

    I bought a new camera (Canon T5i) and took photos in RAW, tried to open them in PSE9 and they wouldn't open. I got the following error...
    Canon RAW Codec found a new CR2 file that is not supported by the installed version.
    You can download the Canon RAW Codec update program from the link below.
    (Canon Server)
    I have been to the link & downloaded what update it had. I have also done the available updates on my PSE9 and I am still getting this error messge. When I called Canon regarding this they said I needed to contact Adobe.
    Can someone please tell me what I am doing wrong or not doing so I can open these files???

    The T5 is supported by Camera RAW 8.4 which needs PSE12. You can use the Canon software to convert RAW to TIF or the Adobe DNG Converter. The converter will convert the CR2 files to Adobes RAW DNG format that will open in PSE9's RAW processor. http://www.adobe.com/uk/products/photoshop/extend.displayTab2.html#downloads.
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Thunderbird can not open .xlsx files directly from it.

    OS: win 7 home premium
    Programs: Microsoft Office 2010 Pro and Mozilla Thunderbird
    - I can open directly from Thunderbird all the attachments except .xlsx. But when I save it on disk, opens just fine. .xls files do not have this problem. File association is ok. Please help!

    Is it set up here:
    Tools > Options > Attachments
    Under 'Content Type'
    Microsoft Office Excel 2010 workbook
    Action: Use microsoft Office excel'
    Note you can click on the action to see a drop down selection if you need to change it.
    then click on OK
    If it is not there then you need to set it up.
    right click on attachment and choose 'open'
    a window pops up asking what to do.
    choose 'Open with' and either 'Microsoft Open XML converter'
    (I have MS Office 2007 so can to use that option)
    or better still select 'Microsoft Office Excel'
    If the option is not available click on 'Other'
    See if option is now available or click on 'Browse'
    and in Microsoft Office, locate the Excel.exe file (it might be in a folder called 'Office 12 or another number) and click on 'Open'
    select: 'Do this automatically for files like this from now on'
    and click on OK

  • I'm experiencing extremely slow response when attempting to open the control center from the lock screen, any suggestions?

    When trying to access the control center from the lock screen, it takes anywhere from 2 to MANY swipes to get a response.  Never opens on the first try.

    I'm not having the same problem, but there is a feature in the OS that attempts to discern from swipes to unlock and swipes to open control center. This is what you may be experiencing.

  • Dreamweaver cc 2014.1 will not open the html files from my business catalyst site

    I just imported my business catalyst site (originally built with Muse) into dreamweaver.  the whole site downloaded as expected and dreamweaver maintains that the 2 folders have the same files.  When I click to open any file in Dreamweaver it appears to open and then close the file immediately giving no indication of a problem. 
    Anyone come across this and or have any idea what could be happening?  I can open these files in Text Wrangler.
    I have followed the steps of deleting preferences etc that I have come across in my search today.  None of those helped. 
    Files from other sites seem to be opening fine.
    Thank you.

    The only files I am encountering this issue with are the ones I downloaded from BC into a brand new folder.  Further, any new files that I create in Dreamweaver and then save to the local root folder of the site I downloaded from BC will no longer open after I close them.  I can open all of the files I downloaded from BC in text wrangler with no problem.  I have about 10 other sites I am having no issues with what so ever.
    I am considering this an isolated issue between Dreamweaver and the folder that I imported my BC site to as I have never had any other issue with using Dreamweaver. 
    But to answer your questions:
    1.  no
    2.  no issue
    3.  yes, no issue.
    4.  yes.  all of them.
    5.  not doing this one. 

  • Not opening the excel workbook from web application

    I am trying the load excel work book from web application and have configured the http authentication while configuring the ADF Secutity. It is asking for the login (weblogic/weblogic1) while load excel workbook, but throws the following exception/error. Please let me know how to resolve this.
    ADFDI-05530: unable to initialize worksheet: Sheet1
    and details are:
    ADFDI-00108: user session required
    The remote server returned an error: (401) Unauthorized.
    ~~~~~~~~~~
    UserSessionRequiredException: ADFDI-00108: user session required
    Source: adfdi-datamanager
    Stack:
    at oracle.adf.client.windows.datamanager.servletrequest.SyncRequest.BeginResponse()
    at oracle.adf.client.windows.datamanager.servletrequest.TamperCheckRequest.InternalCallSyncServlet()
    at oracle.adf.client.windows.datamanager.servletrequest.SyncServletRequest.CallSyncServlet(Boolean retry)
    at oracle.adf.client.windows.datamanager.ADFBindingContext.SendSyncServletRequest(SyncServletRequest request)
    at oracle.adf.client.windows.datamanager.ADFBindingContext.CheckForTampering()
    at oracle.adf.client.windows.datamanager.ADFBindingContext.PreSyncServletTamperCheck()
    at oracle.adf.client.windows.datamanager.ADFBindingContext.SyncModel(BindingContainer bc, String contentType)
    at oracle.adf.client.windows.datamanager.BindingContainer.ReloadMetadata()
    at oracle.adf.client.windows.datamanager.BindingContainer.LoadMetadata()
    at oracle.adf.client.windows.excel.runtime.DIWorksheet.Initialize()
    Inner:
    WebException: The remote server returned an error: (401) Unauthorized.
    Source: System
    Stack:
    at System.Net.HttpWebRequest.GetResponse()
    at oracle.adf.client.windows.datamanager.servletrequest.http.ManagedHttpResponse..ctor(HttpWebRequest request)
    at oracle.adf.client.windows.datamanager.servletrequest.http.ManagedHttpRequest.GetResponse()
    at oracle.adf.client.windows.datamanager.servletrequest.SyncRequest.BeginResponse()

    Thanks for your quick reply. I have tried giving permission to all the page definition for the test-all role. But still I am getting the following error.
    [JpsAuth] Check Permission
    PolicyContext: [UI#V2.0]
    Resource/Target: [getSubjectFromDomainCombiner]
    Action: [null]
    Permission Class: [javax.security.auth.AuthPermission]
    Result: [SUCCEEDED]
    Subject: [null]
    Evaluator: [SM]
    [JpsAuth] Check Permission
    PolicyContext: [UI#V2.0]
    Resource/Target: [sessiondef._FDMApplicationVO_0_DynReg_com_hyperion_aif_gl_common_setup_userinterface_pageDefs_regFDMApplicationsPageDef]
    Action: [view]
    *Permission Class:     [oracle.adf.share.security.authorization.RegionPermission]*
    *Result:               [FAILED]* Evaluator: [ACC]
    Failed ProtectionDomain:ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
    CodeSource=file:/C:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/adf-share-support.jar Principals=total 3 of principals(
    1. JpsPrincipal: oracle.security.jps.internal.core.principals.JpsAnonymousUserImpl "anonymous" GUID=null DN=null
    2. JpsPrincipal: oracle.security.jps.internal.core.principals.JpsAnonymousRoleImpl "anonymous-role" GUID=null DN=null
    3. JpsPrincipal: oracle.security.jps.service.policystore.ApplicationRole "test-all" GUID=48AD91A06D7511DFBFDBE5A03915DD7D DN=null)
    Permissions=(
    oracle.adf.controller.security.TaskFlowPermission//data/data-task-flow-definition.xml#data-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//dim/dimension-task-flow-definition.xml#dimension-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/Access-Denied-task-flow-definition.xml#Access-Denied-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/setup-flow-definition.xml#setup-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//writeback/writeBack-task-flow-definition.xml#writeBack-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/regApp-task-flow-definition.xml#regApp-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//writeback/valueMapping-task-flow-definition.xml#valueMapping-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//process/processDetails-task-flow-definition.xml#processDetails-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/importProfile-task-flow-definition.xml#importProfile-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/categoryMapping-task-flow-definition.xml#categoryMapping-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/srcAcctEnties-task-flow-definition.xml#srcAcctEnties-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//hr/hr-task-flow-definition.xml#hr-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/regSrcSystem-task-flow-definition.xml#regSrcSystem-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/regFDMApps-task-flow-definition.xml#regFDMApps-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/periodMapping-task-flow-definition.xml#periodMapping-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//setup/location-task-flow-definition.xml#location-task-flow-definition/customize,grant,personalize,view
    oracle.adf.controller.security.TaskFlowPermission//dim/memberMapping-task-flow-definition.xml#memberMapping-task-flow-definition/customize,grant,personalize,view
    (java.io.FilePermission \C:\Oracle\Middleware\oracle_common\modules\oracle.adf.share_11.1.1\adf-share-support.jar read)
    (java.net.SocketPermission localhost:1024- listen,resolve)
    (oracle.security.jps.service.credstore.CredentialAccessPermission context=SYSTEM,mapName=*,keyName=* *)
    (java.util.PropertyPermission line.separator read)
    (java.util.PropertyPermission java.vm.version read)
    (java.util.PropertyPermission java.vm.specification.version read)
    (java.util.PropertyPermission java.vm.specification.vendor read)
    (java.util.PropertyPermission java.vendor.url read)
    (java.util.PropertyPermission java.vm.name read)
    (java.util.PropertyPermission os.name read)
    (java.util.PropertyPermission java.vm.vendor read)
    (java.util.PropertyPermission path.separator read)
    (java.util.PropertyPermission java.specification.name read)
    (java.util.PropertyPermission os.version read)
    (java.util.PropertyPermission mds.store.filesystem.path read)
    (java.util.PropertyPermission os.arch read)
    (java.util.PropertyPermission java.class.version read)
    (java.util.PropertyPermission java.version read)
    (java.util.PropertyPermission file.separator read)
    (java.util.PropertyPermission java.vendor read)
    (java.util.PropertyPermission java.vm.specification.name read)
    (java.util.PropertyPermission java.specification.version read)
    (java.util.PropertyPermission java.specification.vendor read)
    (oracle.security.jps.service.policystore.PolicyStoreAccessPermission context=APPLICATION,name=* getApplicationPolicy)
    (java.lang.RuntimePermission stopThread)
    (java.lang.RuntimePermission exitVM)
    oracle.adf.share.security.authorization.RegionPermission/com.hyperion.aif.gl.drilldown.userinterface.pageDefs.drilldownPageDef/view
    oracle.adf.share.security.authorization.RegionPermission/com.hyperion.aif.gl.common.setup.userinterface.pageDefs.MainPageDef/grant,view
    Call Stack: java.security.AccessControlException: access denied oracle.adf.share.security.authorization.RegionPermission/sessiondef._FDMApplicationVO_0_DynReg_com_hyperion_aif_gl_common_setup_userinterface_pageDefs_regFDMApplicationsPageDef/view java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
    java.security.AccessController.checkPermission(AccessController.java:546)

  • CS5 Bridge and Photoshop not opening the CR2 files from my Canon 6D. Please help!

    Any and all ideas would be appreciated greatly. Working on a deadline. Thank you so much!

    Cannon 6D requires CS6 with ACR 7.3.  You either have to upgrade or convert to DNG files.

  • My cursor does not open many links.  If I get a message on Linkedin the "Accept" rectangle does not work when I put my cursor on it.

    M cursor changs from an arrow to the text (tall I) icon when I move it over links and "unsubscribes" and I can't respond to either Facebook or Likedin buttons.
    Often if I get a link in an e-mail message my cursor will not open the link.  The arrow changs back to the txt cursor and the link won't open.  Help!
    people send me important mesage telling me to hit a link to open something but my cursor won't open the link.???

    First check your trackpad settings to make sure all is correct.
    /Library/Preferences.  Trash the com.apple.finder.plist file. 
    Disconnect all peripherals from your computer.
    Boot from your install disc & run Repair Disk from the utility menu. To use the Install Mac OS X disc, insert the disc, and restart your computer while holding down the C key as it starts up.
    Select your language.
    Once on the desktop, select Utility in the menu bar.
    Select Disk Utility.
    Select the disk or volume in the list of disks and volumes, and then click First Aid.
    Click Repair Disk.
    Restart your computer when done.
    Repair permissions after you reach the desktop-http://support.apple.com/kb/HT2963 and restart your computer.
    Empty the trash.   

  • Additional tab will not open for links

    previously i have been able to click on a link, and the link would open in a new window or tab. but now whenever i try to open a link through a website, it will not open the link in a new window or new tab. how can i fix this?

    Hi ArletteGH, I'm not sure which one of these is the better description of your issue:
    If you Ctrl+click or middle-click a link:
    * Firefox creates a new tab, loads the link in that tab, but the tab stays in the background rather than being made active (default behavior)
    * Firefox creates a new tab, but doesn't actually fetch the page until you make the tab active
    * Firefox creates a new tab, but the tab and address bar stay blank, as though the address never got transferred to the page
    Are any of those close to describing your problem?

  • Safari Not Opening External Links

    When I click on any external link, eg: from Mail, Dashboard, a link icon on my Desktop, etc, Safari comes to the front, but does not open the link. Also when I try to "Reopen All Windows From Last Session", after reopening it, nothing happens. If I have a window open, I can drag a link off my desktop, drop it on the window, and the link will open.
    I have tried resetting the cache per this link:
    http://discussions.apple.com/thread.jspa?messageID=8777756&#8777756
    Also running Macjanitor, and repairing permissions. None of these worked. Any suggestions?

    That worked, thank you so much. Although I am a bit embarrassed that I didn't think to do that in the first place.
    I also want to explain what caused it, and what happened after I reopened safari. The problem started after I installed Verizon Access to use with Verizon's wireless broadband; it crashed Safari, but at the time I didn't notice any anomalies upon restarting Safari. It took a couple days to realize that Safari wasn't opening any external links.
    When I went to the preferences folder to remove the safari preference, there were two: one was "com.apple.Safari.plist" and the other was "com.apple.Safari.plist.saved". I put them both on the Desktop and reopened Safari.
    I don't have a Home Page selected, I prefer just a blank window when I open Safari, but it opened a Verizon page instead. So I went to Safari's Preferences and removed it. Restarted the browser, but it was back. It took a couple tries, but now Safari opens with an empty window again, and everything else is back to normal.
    What's odd is that the Verizon page didn't show up as the home page until I removed the .plist files from the Library.

Maybe you are looking for

  • Current Patch Set for Oracle Database Release 11.2

    Hi I am upgrading oracle 10G to 11GR2 in AIX 5.3 Environment with SAP ECC6 , I have just just installled Oracle 11.2.0.1.0 according to the "Database Upgrade Guide -Upgrade to Oracle Database 11g Release 2 (11.2): UNIX". After database software insta

  • Syncing iphone using more than one computer

    Does anyone know how to get iphone to sync to more than one computer? I activated my wife's iphone from my computer (after having logged into her itunes account) but when I try to sync from her computer (logged into her account) nothing happens.

  • Help installing PSE10/Premier onto Mac from PC without software CD

    Help installing PSE10/Premier onto Mac from PC without software CD.  I can't find my software box anywhere..... Is there a way to locate my serial number within the programs?  AND how can I download the programs from your site- all I see are download

  • Timing a zoom in imovie 08

    hi! i know what i am trying to do MUST be very simple, but imovie has me tearing my hair out! maybe its just a math problem? my movie is a single image. i want the first frame to be an extreme close-up, & then slowly zoom out to the full image on the

  • Charged Twice. What to do?

    Another problem !! On 16th March 2013 I bought whatsapp from the app Store ... its original price is 55 rupees (i.e 1 $ something) . When I bought it, it charged me 60 rupees (1.1 $) and again today (18th March 2013)  55 rupees why double charge? Wha