ASP. NET personal development problems and answers

Source: Internet
Author: User
Reprint please indicate: http://blog.csdn.net/jiangsq12345

I. Why is a strange string automatically generated in the URL during the vs2010 test?

Run: localhost/myclass. aspx
Press Enter: localhost/(sviecu555gar4v55ogmacsfg)/myclass. aspx

A: This is how ASP. NET records sessions. If cookies are disabled on the client, the session ID is recorded at the URL location.

You can remove cookieless = true from the Web. config configuration file.

2. How can I display the HTML code in the database to the page after I use kindeditor to save the content to the data?

A:

Add the. ASPX page

<div id="divBody" runat="server"></div>

Then add

Divbody. innerhtml = "the HTML code you want to display ";

3. When the button control is used, the page redirection of onclick cannot be executed.

A: Because the type of the button control is submit, there is a page Redirection action (refresh on this page), so a conflict is generated.

<Asp: button id = "btn_send" runat = "server" text = "send" onclick = "msgsend_click"/>

The solution is to replace the button control with HTML input.

<Div id = "btn_send" runat = "server" text = "send" onclick = "msgsend_click"/>

4. Save the HTML code to the local Word Document

// Call this method to export it as a Word document, and the input parameter is this. page public static void getwordfile (string msgname, string msg_content, system. web. UI. page) {httpresponse resp = page. response; resp. clear (); resp. buffer = true; resp. contentencoding = system. text. encoding. getencoding ("gb2312"); resp. addheader ("content-disposition", "attachment; filename =" + msgname); resp. contenttype = "application/MSWord"; msg_content = "<HTML xmlns = 'HTTP: // www.w3.org/5o/xhtml'>" + msg_content + "

Msg_content is the HTML code to be output.


5. When the MS Word component is called to convert Word to PDF format

[4317 the interoperability type "Microsoft. Office. InterOP. Word. applicationclass" cannot be embedded ". Use the applicable interface instead .] Error

  • Solution:
  • In Visual Studio, click the menu item "View-> solution Resource Manager", open the "Reference" folder, and go to "Microsoft. office. interOP. on word, right-click it and select "attribute". In this case, change the value of "embedded interoperability type" in the attribute to "false.

6. Free solution for generating PDF files using HTML code

Refer to my other blog

Http://blog.csdn.net/jiangsq12345/article/details/7615974

7. import data from Excel to SQL Server

Step 1: Click Start and select Run, and enterDtswizardAnd then install the prompt step by step.

8. The client URL remains unchanged, but the page is redirected

The method is to obtain the returned page content from another page on the server

Server. Tansfer ("other. aspx ");

IX. Front-end input content verification

Only regular expressions in Chinese are allowed: \ u4e00-\ u9fa5

10. Waiting interface for front-end submission

<Div id = "runing" runat = "server" style = "Z-index: 12000; left: 0px; width: 100%; cursor: Wait; position: absolute; top: 0px; Height: 100%; visibility: hidden "> <Table width =" 100% "Height =" 100% "> <tr align =" center "valign =" Middle "> <TD> <Table width =" 200 "height = "120" bgcolor = "gray" style = "filter: alpha (opacity = 70); color: white "> <tr align =" center "valign =" Middle "> <TD> <Div id =" clocktimes "> </div> <br> searching <br> Please wait .... </TD> </tr> </table> </div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.