asp.net-Online printing of the form - asp.net

I am developing an online application in which I need to take a printout of the data entered in the form,but on that printed page,at right corner I am getting my page url (e.g. http://www.growmoney.com/print.aspx) printed.
I don't want it to be printed on the printout.
Is there any solution for this?

The address, date, time etc is typically added by the browser itself and can be configured by the user. How this is configured differs from browser to browser, instructions can easily be found. However, to my knowledge there is no way for an html page to influence those settings. Instead you could generate e.g. a PDF file of the form and let the user print that. This should give a more predictable print out. Alternatively you could explain to the user how to change the settings to not print the header and footer.
See also Disabling browser print options (headers, footers, margins) from page?

Related

What are the effects of changing the default page in Google Analytics?

I am new to Google Analytics and need to make a change, we are adding site search. I can't save the site search change because GA has some incorrect info in it and will not let me save any changes. Specifically, the default page can't have slashes. So, when I try to save my other change, I get this error.
It seems to me that the info that we have now is incorrect and isn't being used by Google.
I am pretty confident that if I remove the "avcat/ctl1642/index.cfm" from the default page I will be able to save it. I am not sure of what effect this will have on reporting, but I will never be able to re-enter that value if it isn't correct.
What are the effects of removing this bit of info? Should I just leave it blank? Shoud I just use index.cfm
Here is the current information that is saved.
The default page is the page that is displayed when a directory name is entered without a filename. For example: A user types mydomain.com/mydirectory/ into the browsers adress bar and the server serves the page mydomain.com/mydirectory/index.html. The exact name of the default page depends on the server configuration (usually it's along the lines of index.html, index.php, index.aspx, default.aspx or similar).
However Google will count mydomain.com/mydirectory/ and mydomain.com/mydirectory/index.html as two different pages, even though they display the same content. So you can enter the name of the default page in Google Analytics to make sure the page count for both urls is aggregated into one value. The value for default page is applied to every url that ends with a trailing slash (and without a filename) since Google assumes that this is a directory name that displays the default page.
"vcat/ctl1642/index.cfm" does not make any sense as setting for a default page since it includes a directory path; a path is not a page. I'm amazed that it was ever possible to enter that value. If Google Analytics actually applied that value then all urls that ended with slash will be mangled (i.e. will have vcat/ctl1642/index.cfm added to them). Removing the value will mean that this does not happen anymore.

Show constant URL for site in asp.net

I have a web site with number of pages, developing in asp.net.
I have a page URL's like:
example:
1) http://www.xyz.com/Home.aspx
2) http://www.xyz.com/Index.aspx
3) http://www.xyz.com/viewMember?Name=abc&id=1
But the end user is at any page, i would like to show the URL like "http://www.xyz.ie".
Is there any setting in web.config ? If not, is there any other way ?
Please help me...
Thanks in advance.
Jagadi
You can not keep one single URL for different page - but you can do some tricks to simulate it.
To make the url stay the same, but the content change, you need to make some trick.
I am not recommend, search engines they will not follow what you do and they show each page different, user can not make bookmark, and average user can easy find the real url of the page, even with one different click on the browser can find it.
One trick is to use frames, or iframes. On the main page you load all the rest inside an iframe, or inside a frame.
Second trick is to use ajax to load each other content.
And finally you can use session to know what to show on the user, user did not change links, but make post back that change the content.

Adjusting Print Page in ASP.NET

I have some printed form on paper and want to create a web page (result of a report) and put those pre-printed pages in printer and print web page for fill the blanks on paper.
What is the best way to adjust the location of contents in the web page to work with any printer correctly?
thnx for your help
If you're just generating a regular html webpage to print, you're going to have a very hard time getting it consistent across multiple computers (or browsers, or printers). There are lots of browser settings that affect how the webpage is printed...like margins, header/footer text, etc. and these aren't things you can control from the html page.
You would need to generate a formatted file so there is less room for interpretation by the computer/browser/printer. Something like a PDF where you can create more consistent output.
I had a similar requirement for an app a while back. The requirements for that project were such that we generated a MS Word document prefilled with content (text, tables, etc.), then the user opens that generated file and prints it or saves it. I would think a PDF would be desirable in most cases though.

Printing receipt ASP.NET

I'm currently making a project where I need to print out a receipt on a receipt printer.
At the moment i'm using the CSS mechanism media=screen , media=print to indicate what to print.
Problem is of course the header and footer which can't be removed, as it is client browser specific.
So i'm wondering if anyone has another suggestion on how to do the printing. Preferbly without using too much IO.
Generally speaking, if you need precise control, your best bet is to have a pdf, or other doocument format that is generated from the server, for your printing. (if the machines printing receipts are controlled, and have word, than .doc (html with an output type) is the easiest method. There are a number of third party controls for generating PDF from server-side code as well. Hope this leads you in a usable direction, since you didn't specify if you controlled the client machines in use.
One benefit to PDF is you can use it as a hard archive, as well as being able to email receipts as an attachment.
The header and footer information (Assuming you're talking about the URL showing up at the bottom of a page) is client-side and there is nothing you can do to change that from server side.
If all of your printing is going to be done from inside your company, you could have a group policy created for Internet Explorer printing to remove these company-wide. You could also just have instructions on your page on how to change these setting manually.
Another option is to print with a 3rd party application, such as PDF, or print it directly from the server if that option is available to you.
Do you mean the page header and footer?
If that's the case, wrap the header and footer in IDs and create CSS tags to target them and give them a much simpler styling, or you can use the CSS element display:none to remove them altogether in the print css.
You could load the content you want to print into an iframe, focus on it, and print that. That way you'll have exact control over what appears on the receipt.
It'd take a small bit of javascript, but I've had success doing similiar things when I wrote a custom contract printer.
It's not an ASP solution, but may help:
http://code.google.com/p/jzebra
It's a java plugin that can bypass the header and footer stuff.

Parsing PlainText Emails from HTML Content (ASP.NET)

Right, in short we basically already have a system in place where the HTML content for emails is generated. It's not perfect, but it works.
From this, we need to be able to derive a plaintext alternative for the email. I was thinking of instantly jumping on and creating a RegEx to strip the <*> tags from the message - but then I realised this would be no good because we do need some of the formatting information (paragraphs, line breaks, images etc).
NOTE: I am OK with actually sending the mail and setting up alternative views etc, this is only about getting plaintext from HTML.
So, I am pondering some ideas. Will post one as an answer to see what you guys think, but thought I would open it up to the floor. :)
If you need any more clarification then please shout.
Many thanks,
Rob
My Solution
OK, so here it is! I thought up a solution to my problem and it works like a charm!
Now, here are some of the goals I wanted to set out:
All the content for the emails should remain in the ASPX pages (as the HTML content currently does).
I didn't want the client code to do anything more other than say "SendMail("PageX.aspx")".
I didn't want to write too much code.
I wanted to keep the code as semantically correct as possible (no REALLY crazy-ass hacks!).
The Process
So, this is what I ended up doing:
Go to the master page for the email messages. Create an ASP.NET MultiView Control. This control would have two views - HTML and PlainText.
Within each view, I added content placeholders for the actual content.
I then grabbed all the existing ASPX code (such as header and footer) and stuck it in the HTML View. All of it, DocType and everything. This does cause VS to whinge a little bit. Ignore It.
I then of course added new content to the PlainText view to best replicate the HTML view in a PlainText environment.
I then added some code to the Master Page_Load, checking for the QueryString parameter "type" which could be either "html" or "text". It falls over to "text" if none present. Dependant on the value, it switches the view.
I then go to the content pages and add new placeholders for the PlainText equivalents and add text as required.
To make my life easier, I then overloaded my SendMail method to get the response for the required page, passing "type=html" and "type=text" and creating AlternateView's as appropriate.
In Summary
So, in short:
The Views seperate the actual "views" of the content (HTML and Text).
A master page auto switches the view based on a QueryString.
Content pages are responsible for how their views look.
Job done!
If any of this is unclear then please shout. I would like to create blog post on this at some point in more detail.
My Idea
Create a page based on the HTML content and traverse the control tree. You can then pick the text from the controls and handle different controls as required (e.g. use ALT text for images, "_____" for HR etc).
You could ensure the HTML mail is in XHTML format so you can parse it easily using the standard XML tools, then create your own DOM serialiser that outputs plain text. It'd still be a lot of work to cover general XHTML, but for a limited subset you plan to use in e-mail it could work.
Alternatively, if you don't mind shelling out to another program, you could just use the -dump switch to the lynx web browser.

Resources