通过电子邮件发送MVC Razor Page [英] Send MVC Razor Page via email

查看:118
本文介绍了通过电子邮件发送MVC Razor Page的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MVC Razor框架的新手。我正在处理的项目需要向用户发送电子邮件。此电子邮件有一个链接可打开一个页面(此页面有上传文件的选项/和两个单选按钮)。当用户点击链接打开一个网页,用户可以输入需要的信息,如上传文件,是或否问题。



我创建一个.cshtml文件在Share文件夹中它工作正常。但我的问题是我如何将此表单/页面发送给用户以及当用户单击提交Btn时如何从用户获取数据和上传文件?





谢谢,

I am new to the MVC Razor framework. The project I am working on require an email send to users. This email has a link which opens a page ( This page has option to upload a file / and two radio button). When user click on the link "A web page open and user can enter require information , such as upload file and yes or no question.

I create a .cshtml file in Share folder and it work just fine. But my issue is how I send this form/page to user and how I get back data and uploaded file from user when user click submit Btn?


Thanks,

推荐答案

你没有发送cshtml文件。发送给用户并不好他们需要ASP.NET引擎来运行它并从中获取一个页面。



Razor用于生成HTML页面,而不是替代它。必须将Razor引擎返回的输出HTML发送到浏览器。为此,您必须向服务器提交GET请求以生成页面,获取响应流,该响应流将包含通常由浏览器,将其作为附件放入文件或重新格式化为putti进入一个电子邮件正文。



不,我没有例子。这不是我做过的事情,也没有任何计划。
You don't send the cshtml file. Sending that to the user does no good as they would need the ASP.NET engine to run it and get a page out of it.

Razor is for generating an HTML page, not a replacement for it. You have to send the output HTML that the Razor engine returns to the browser. In order to do this, you would have to submit a GET request to the server to generate the page, get the response stream which will contain the HTML normally rendered by the browser, put that into a file as an attachment or reformat it for putting into an email body.

No, I don't have examples. This is not something I've ever done, nor have any plans for at all.


这篇关于通过电子邮件发送MVC Razor Page的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆