C
C#โ€ข2y ago
NullReference

โœ… Redirect ASP.NET

Hi. I would like to insert styles on the page first, and then output a JSON file, but I don't understand how to do it.
30 Replies
NullReference
NullReferenceOPโ€ข2y ago
I tried everything I knew.
x0rld ๐Ÿ‘ป ๐ŸŽƒ
why you want to load css like that ? ๐Ÿค” why not use the css injector classic in asp.net core ?
NullReference
NullReferenceOPโ€ข2y ago
I am beginner. I don't know what is this๐Ÿ˜…
x0rld ๐Ÿ‘ป ๐ŸŽƒ
ah you are using razor for the views ?
NullReference
NullReferenceOPโ€ข2y ago
ok, i will try it :/
x0rld ๐Ÿ‘ป ๐ŸŽƒ
it's like that for razor ( the .cshtml files )
@section styles {
<link href="@Url.Content("~/your/path/index.css")" rel="stylesheet" type="text/css" />
}
@section styles {
<link href="@Url.Content("~/your/path/index.css")" rel="stylesheet" type="text/css" />
}
NullReference
NullReferenceOPโ€ข2y ago
I am just learning controllers. I haven't used view yet))
x0rld ๐Ÿ‘ป ๐ŸŽƒ
it's an api ? ๐Ÿค”
NullReference
NullReferenceOPโ€ข2y ago
idk๐Ÿ˜… I found a website for studying ASP.NET . And first they teach you how to use controllers
x0rld ๐Ÿ‘ป ๐ŸŽƒ
can you give me the link
NullReference
NullReferenceOPโ€ข2y ago
ASP.NET Core MVC | ะŸะพะปะฝะพะต ั€ัƒะบะพะฒะพะดัั‚ะฒะพ
ะŸะพะปะฝะพะต ั€ัƒะบะพะฒะพะดัั‚ะฒะพ ะฟะพ ัะพะทะดะฐะฝะธัŽ ะฒะตะฑ-ะฟั€ะธะปะพะถะตะฝะธะน ั ะฟะพะผะพั‰ัŒัŽ ั„ั€ะตะนะผะฒะพั€ะบะฐ ASP.NET Core MVC ะฝะฐ ัะทั‹ะบะต ะฟั€ะพะณั€ะฐะผะผะธั€ะพะฒะฐะฝะธั C#
NullReference
NullReferenceOPโ€ข2y ago
its russian site so, I am also from Russia๐Ÿ˜…
x0rld ๐Ÿ‘ป ๐ŸŽƒ
np thanks to translator ๐Ÿ˜‚
NullReference
NullReferenceOPโ€ข2y ago
))
x0rld ๐Ÿ‘ป ๐ŸŽƒ
in the chapter 1 there is views ๐Ÿค” https://metanit.com/sharp/aspnetmvc/1.3.php
NullReference
NullReferenceOPโ€ข2y ago
But it does not describe how to work with them
x0rld ๐Ÿ‘ป ๐ŸŽƒ
oh yeah oh ok you are in the second chapter ?
NullReference
NullReferenceOPโ€ข2y ago
yeah I know that since I am nobody does. But I just wanted to do something of my own with what I know now.
x0rld ๐Ÿ‘ป ๐ŸŽƒ
public class HomeController : Controller
{
public string Index()
{
string tomJson = JsonSerializer.Serialize(tom,jsonSettings);
return $"{yourStyleContent}{tomJson}";
}
public class HomeController : Controller
{
public string Index()
{
string tomJson = JsonSerializer.Serialize(tom,jsonSettings);
return $"{yourStyleContent}{tomJson}";
}
you can do something like that @NullReference you understand ?
NullReference
NullReferenceOPโ€ข2y ago
i'm tryinng it now one sec
NullReference
NullReferenceOPโ€ข2y ago
NullReference
NullReferenceOPโ€ข2y ago
error 406
x0rld ๐Ÿ‘ป ๐ŸŽƒ
show me where did your write the code
NullReference
NullReferenceOPโ€ข2y ago
I fixed the bug issue, but now it looks like this
x0rld ๐Ÿ‘ป ๐ŸŽƒ
oh ๐Ÿค” let me try something
NullReference
NullReferenceOPโ€ข2y ago
I could!
Response.ContentType = "text/html";
Response.ContentType = "text/html";
NullReference
NullReferenceOPโ€ข2y ago
x0rld ๐Ÿ‘ป ๐ŸŽƒ
maybe oh yeah didn't think about that xD
NullReference
NullReferenceOPโ€ข2y ago
Thanks!!! You are the best)))
x0rld ๐Ÿ‘ป ๐ŸŽƒ
๐Ÿ‘Œ you can close with /close
Want results from more Discord servers?
Add your server