|
Hi all I am having my print code as follows
public void print()
{
try
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.PrinterSettings.PrinterName = "SnagIt 10";
pd.Print();
}
catch (Exception Ee)
{
}
}
Which works fine when I build and run directly from the application, but when I host my application to my IIS I am unable to print to Snag IT what might stopping this to happen can some one tell.
|
|
|
|
|
Is the SnagIt 10 printer accessible from the IIS server?
|
|
|
|
|
hi richard thanks for the reply you can use this code also pd.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
XPS document is access from IIS .
|
|
|
|
|
Have you checked if user authorized for printing? The standard user for IIS is very thin and can't access almost nothing outside IIS...
Check the machine's log for possible errors/warnings...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
hi Kornfeld,
thanks for the reply but i have check all the possible ways there no error in eventviewer(machine log). permission is given to IIS user.
it's better if you run the same code from your system then you understand the problem very well it's small code
|
|
|
|
|
When you deploy your code, it runs under a specific user account on the server, as configured in the properties of the application pool. That user account most likely doesn't have any printers configured - not even the ubiquitous "XPS" printer. You might be able to resolve the problem by copying some registry keys, as described in this MS KB article[^], but you'll need to know the SID of the AppPool user in order to copy the keys to the correct account.
Also, remember you're printing on the server. If you're expecting the output to appear on the client's printer, you're out of luck.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
salam i make a simple user login form so i want to attach database how i can do
|
|
|
|
|
|
WHEN I AM GOING TO INSTALL ANY SOFTWARE THEN THIS ERROR MESSAGE GIVE:
THE SERVICE DID NOT RESPOND TO THE START OR CONTROL REQUEST IN A TIMLY FASION
|
|
|
|
|
Good day friends! Am having problem with my asp.net project. I have two buttons on the web page. One save to “Temp Files” and the other save to “UploadedImgs”. Saving to the “Temp Files” folder do not raise any exception but saving to the “UploadedImgs” folder causes an exception which says “Could not find a part of the path 'D:\ASP.Net Practical\Website\Site1\ UploadedImgs \'.” To me, the path is 100% correct. So please, does anyone has solution to this problem? Any help will be appreciated.
Below is the code am using.
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim imgext As String = Path.GetExtension(FileUpload1.PostedFile.FileName) 'get image extension
Dim Imgname As String = Path.GetFileName(FileUpload1.PostedFile.FileName) 'get image name
Dim imgpath As String = "\ASP.Net Practical\Website\Site1\ UploadedImgs \" 'get local disk folder path
FileUpload1.PostedFile.SaveAs(Server.MapPath(imgpath + Imgname + imgext))
End Sub
|
|
|
|
|
Clean the save filename first, remove or strip invalid chars, then build the path based on a virtual path, not a physical path. The path will then be converted to a physical path with the Drive letter and all.
Dim fileName as String = Clean_FileName(avatarName.ToLower() + oFileExt)
Dim path as string = Path.Combine(Server.MapPath("~/Images/avatars/customers"), fileName)
Public Shared Function Clean_FileName(ByVal strIn As String) As String
' Replace invalid characters with empty strings.
Try
Return Regex.Replace(strIn, "[^\w.@-_]", "", RegexOptions.None, TimeSpan.FromSeconds(1.5))
Catch As RegexMatchTimeoutException
Return String.Empty
End Try
End Function
|
|
|
|
|
Solved: Thanks. I found the solution after so many trials. I think I should share this so that anyone with such problem could resolve it with ease. The problems was from my webpage submitting an empty filename because of the page load event. So, the solution to this problem is ensure that the uploaded filename is intact before calling the SaveAs command.
Once again, thanks for your reply.
Cheers!
|
|
|
|
|
Well yes that's a good idea.
But the way your mapping out the path may backfire on you when you publish your web app for production use.
Uploading files of anything requires good knowledge of how it works. There about 5 ways to do it to my knowledge.
I don't use the file name of the file anymore, for now I assign my own name to the file. Later on down the road, as users keep uploading the same file with different names, you will have gigs of files sitting in the folder, and the project size will radically expand in size over the course of time. Then what? That's another topic for discussion.
|
|
|
|
|
Anybody please suggest how to set the DataTable Width in dot net.
|
|
|
|
|
What DataTable are you talking about? Have you checked the documentation for class properties?
|
|
|
|
|
DataTable does not have a width, DataTable Properties (System.Data)[^], since it does not have a UI component.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi All,
I am writing my AngularJS - js file as below and using ng-repeat as well as below, but when I add or remove item into the list angularJS is not refreshing it automatically on View, am I missing something, it is happening on IE but on Chrome its refreshing the list automatically. Am I missing something or do I need to explicitly refresh the list etc to show the most updated list on IE, I have to use only IE at my work - please any help is appreciated thank you.
Here is my View
<body><br />
<div data-ng-app="myApp" data-ng-controller="userController">
<table style="border:none 0px gray;">
<tr>
<td>
<table style="border:solid 1px gray;">
<tr>
<td style="border:solid 1px gray;">User Id</td>
<td style="border:solid 1px gray;">User Name</td><br />
</tr>
<tr data-ng-repeat="usr in users">
<td><a href="/User/UpdateUser/{{usr.UserId}}"> {{usr.UserId}} </a> </td>
<td><a href="/User/UpdateUser/{{usr.UserId}}">{{usr.UserName}}</a></td><br />
</tr>
</table>
<pre>
</td>
<td>
<a href="http://www.codeproject.com/Members/html">@Html</a>.ActionLink("Create User", "CreateUser")
</td>
</tr>
</table>
</body>
And here is my script
var myApp = angular.module('myApp', []);
myApp.controller('userController', ['$scope', '$http', function ($scope, $http) {
$scope.users = "";
$http.get("/User/GetUsers")
.success(function (result) {
$scope.users = result;
})
.error(function (result) {
console.log(result);
});
}]);
Here is my Controller Action method, when an item is added to the list, it will call the Idex method which calls this AngularJS function but some how the function is not getting called and the update on the View is not showing up, please help me.
public ActionResult CreateUser()
{<br />
return View();
}
[HttpPost]
public ActionResult CreateUser(FormCollection collection)
{
try
{
string Id = Request.Form["UserId"];
string UserName = Request.Form["UserName"];
int UserId;
var dbContext = new MVCDBContext();
User user = new User();
user.UserId = (int.TryParse(Id, out UserId) ? UserId : 0);
user.UserName = UserName;
dbContext.Users.Add(user);
dbContext.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 31-Jul-16 5:00am.
|
|
|
|
|
If it's working in Chrome, but not in IE, then it's an IE compatibility issue.
Which version of IE are you using? And which version of AngularJS?
According to this document[^], v1.3+ support IE9+. They automatically run tests against IE9, IE10 and IE11, so it should work in those versions, with a few caveats which are listed in that document.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Its IE 11 I think it should work without issues.
And my AngularJS version is: AngularJS v1.5.5
Is it a problem?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
According to the Angular site, that should be fine.
Can you reproduce the problem in a simple JSFiddle[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry the problem is its not one form and the problem not happening when I call first time, it happens when I insert into Database by using "Create Form" and redirect to the List page using "Action method", whatever is inserted in to Database using Action method should reflect in the List page when its loaded.
First time yes AngularJS is bringing all data I think maybe second time IE is just getting values from Cache rather than calling the method to get values from database.
Is there anyway to escape from this behavior of IE.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Yes, caching sounds like the culprit.
There are various options to disable caching. You can either change the server code to override the caching headers; or configure the caching headers in IIS; or change the Angular configuration[^] to prevent it from caching responses to AJAX requests.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Use ng-href instead.
<td><a ng-href="/User/UpdateUser/{{usr.UserId}}"> {{usr.UserId}} </a> </td>
<td><a ng-href="/User/UpdateUser/{{usr.UserId}}">{{usr.UserName}}</a></td>
See: https://docs.angularjs.org/api/ng/directive/ngHref[^]
Also:
<a href="http://www.codeproject.com/Members/html">@Html</a>.ActionLink("Create User", "CreateUser")
Not sure if this happened when you pasted it in, but that's pretty broken.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Yes
"@Html.ActionLink("Create User", "CreateUser")"
This happened why I posted.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
How can I print from web application in asp.net mvc ? Please check "PrintFromWebApplication" document. pdf PrintFromWebApplication [PDF/274KB] http://download.brother.com/pub/com/dev/pdf/bpac_webapplication_eng.pdf
|
|
|
|