|
You're passing the path of a file on the client to the server, and then trying to open that file on the server.
It works when you're running it locally, because the client and server are the same machine. When you deploy to a real server, the client and server are different machines, and the server has no access to the client's file system.
You need to post the contents of the file to the server, and process the posted contents. Since you're using an AJAX request, you'll need to use the FormData object:
NB: This is not supported[^] in IE9 or earlier.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
I trying get ssrs 2008 up and running on a new server.
I got everything to work just like it dit on my old server and I can deploy reports and view them in the report manager, but I cannot seem to view a report from asp.net applications either in a reportviewer or using the reportexecutionservice. I keep getting the error: The request failed with HTTP status 401: Unauthorized
This is the first time that I had to set up ssrs so I do not know whether I have missed something. I tried to make everything the same as the instance on my old server.
Any assistance would be appreciated.
The following code is what I use for the web execution service and it used to work fine.
This code basically just renders the report as a pdf and downloads it.
rs.Credentials = New System.Net.NetworkCredential("username", "password", "domainname")
Dim reportPath As String = "/OLS/" & ReportName
Dim ResultStream() As Byte
Dim StreamIdentifiers() As String = Nothing
Dim optionalParams(1) As ParameterValue
Dim OptionalParam As String = Nothing
Dim optionalWarnings As WebReference.Warning() = Nothing
optionalParams(0) = New WebReference.ParameterValue
optionalParams(0).Name = "WarningID"
optionalParams(0).Value = Session("ID")
' Create and set the content type string
Dim contentType As String = "application/pdf"
Dim historyID As String = Nothing
Dim devInfo As String = "<deviceinfo><toolbar>False"
Dim format As String = "PDF"
Dim extension As String = ""
Dim encoding As String = ""
Dim mimeType As String = ""
Dim warnings As Warning() = Nothing
Dim streamIDs As String() = Nothing
Dim WarningID As String
WarningID = Session("ID")
Dim execInfo As New ExecutionInfo
Dim execHeader As New ExecutionHeader()
rs.ExecutionHeaderValue = execHeader
execInfo = rs.LoadReport(reportPath, historyID)
rs.SetExecutionParameters(optionalParams, "en-us")
Dim FilePath As String
FilePath = "c:\WebDocuments\OLS\TempDocs\" & Session("EmployeeID") & "\"
Try
ResultStream = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)
execInfo = rs.GetExecutionInfo()
Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)
Catch err As SoapException
'Console.WriteLine(e.Detail.OuterXml)
End Try
' Write the contents of the report to an MHTML file.
Try
Dim stream As FileStream = File.Create(FilePath + WarningID + ".pdf", ResultStream.Length)
Console.WriteLine("File created.")
stream.Write(ResultStream, 0, ResultStream.Length)
Console.WriteLine("Result written to the file.")
stream.Close()
Catch err As Exception
Console.WriteLine(err.Message)
End Try
'insertDownload(ClientID)
'Response.Redirect(Request.Url.ToString)
' ResultStream = rs.Render("/" & sReportPath & "/" & sReportName, "PDF", Nothing, "<deviceinfo><streamroot>/RSWebServiceXS/", optionalParams, Nothing, Nothing, OptionalParam, OptionalParam, optionalParams, optionalWarnings, StreamIdentifiers)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Type", contentType)
Response.AddHeader("Content-Disposition", "attachment;filename=" & WarningID & ".pdf")
Response.BinaryWrite(ResultStream)
Response.Flush()
Response.End()
End Using
|
|
|
|
|
Can you please tell me a sample format of username and password. Most probably it will be the issue of authorization. It will be happen when the username and password is correct or the user trying to access have no permission to access that server.Also try to pass username without specify domain.
|
|
|
|
|
Thanks for your response.
I am using the system administrator account details and I am not specifying the domain. I use something like this:
Username: administrator
Password: mylxghs
|
|
|
|
|
I hope that's not your real administrator password!
If it is, you should change it immediately.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In which line do you get that exception?
|
|
|
|
|
Hi all,
I have a problem with default css template.
I downloaded free example css website template and I would like to apply to my Asp .NET MVC 4 project. I found some articles and one major movie in youtube which describes how to do that, but in version 3, which does not include @Razor...
Unfortunately I am not able to adjust this to my current version of asp .net version 4.
Could you be so kind and help me step by step how should i do that ?
Best Regards
|
|
|
|
|
You can follow the same steps in that video. The only changes will be the syntax. You should change aspx syntax to razor. can you provide me the youtube link you had tried? also let me where you are stuck. So i can help you one by one.
|
|
|
|
|
Dear Jameel,
Thanks for your reply. I finally did it. If I have any problems later I will ask you again for your help.
Meanwhile, thank you very much
Best regards
|
|
|
|
|
Good day friends.
I need an advice in this issue.
In order to keep section state alive, i used timer control to be downloading images every 5 secs. I wanted to use javascript but something came to my mind that what if javascript is not enabled in the client's device, so i had to use timer control as alternative. Now my question is, is it a good practice to use timer control in keeping section state alive and is it good for web applications? Any advice is welcome. Thanks!
|
|
|
|
|
Before answer you let me ask some questions...
Why keep the session alive?
Do you know how much it costs - in resources - to keep all your sessions alive?
Did you checked all the alternatives to live-forever-session?
I believe that after answering these question you will no ask the original question anymore...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
The timer control relies on javascript, so if javascript is not enabled, the timer won't work either.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ok. Get it now. Thanks alot!
|
|
|
|
|
1. As already pointed out the timer control will use javascript. The only way to send something back to the server without a full postback is to use javascript so you'll have to.
2. Every 5 seconds? That is way overkill. If your session is set to the default of 30 minutes then send a keep-alive message every 20 or 25 minutes, not every 5 seconds.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Ok. Get it now. Thanks alot!
|
|
|
|
|
You're welcome.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Increase session timelength and change it's mode
<sessionstate timeout="300" mode="StateServer">
<div class="signature">Sankarsan Parida</div>
|
|
|
|
|
the all .bak file which is stored in the following folder in my system
E://DATABASE_BACKUP/
|
|
|
|
|
Not clear!
Are you using Management Studio? Want to write code?
All BAK files go to the same DB or to separate DBs?
You have to provide much more details to get some valuable answers...
(And try to post DB questions in the right forum - this one is for C#)
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
i am using Sql Server 2008 and want to be restore multiple .bak file at a time with different Name which is stored in E://DATABASE_BACKUP/
and where exactly should i restore all database
how to write script
can you explain step by step
|
|
|
|
|
I'm making a content editor for my website.
To keep it simple, I will create a html file and store it in App_Data. A server control on the front end will read the html file in App_Data, and print the contents of it where its placed on the page.
I built an editor on the back end using ckEditor. Wrote a program to take the contents of the ckEditor, and write an HTML file to the App_Data folder.
So the program gets the HTML from ckEditor, passes it as a unicode string, converts it to a byte array, and writes the bytes using FileStream.
I want to store some extra stuff in the file besides HTML like
Created By:
Revision:
Template:
Without me just going off writing code on a bad idea, I thought maybe I'd try and get some suggestions
Here are some bad ideas that I have:
Write a block of XML at the beginning of the file, on read, consume the XML, then digest and print the HTML.
Just write a block of some format, and do the same as above, but what format?, XML, JSON, ?
Write a separate file such as xml, that describes the html file.
Overall, in the end, I want to be able to just read the files in the /APP_Data/CE folder so I can load a list of registered editable content within my website.
I found this, but not sure if it's viable.
http://www.howtogeek.com/howto/windows-vista/stupid-geek-tricks-hide-data-in-a-secret-text-file-compartment/[^]
Would it be possible to just make a structure, convert it to bytes, and wrap it or something, and place it at the beginning of the file?
modified 30-Aug-14 23:00pm.
|
|
|
|
|
Writing dynamic data to html file, text file or xml or any flat file is not a good idea. These files are meant to store configuration related stuffs.
You should not store user provided data at the same place where the application is hosted. You will have a very hard time to backup, migrate or scale your app to web farm application or implement any further level of change.
I would recommend to use database for your issue. With database, it will be easy to migrate, schedule backup, query, cache, scale etc.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
What do mean by dynamic data?
It's just a HTML file with HTML on it. Just website content, words and pictures.
I just wanted to store some extra stuff like in a image file, just some data.
But I'm starting to think that's its a bad idea anyways.
Today I wrote some code that makes a XML file that represents the editable content, and the XML file points to the HTML file.
|
|
|
|